Created
March 21, 2012 07:39
-
-
Save hidsh/2145496 to your computer and use it in GitHub Desktop.
xyzzy: replace '/' <--> '\' at current line (for path string win and linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun slash-to-backslash-line () | |
"replace '/' <--> '\' at current line. (toggle)" | |
(interactive) | |
(save-excursion | |
(let ((eol (progn (goto-eol) (point))) | |
(bol (progn (goto-bol) (point)))) | |
(save-restriction | |
(narrow-to-region bol eol) | |
(let (from to) | |
(cond ((looking-for "\\") (setq from "\\") | |
(setq to "/")) | |
((looking-for "/") (setq from "/") | |
(setq to "\\"))) | |
(when from | |
(replace-buffer from to))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment