Created
July 31, 2012 13:26
-
-
Save Frozenlock/3217025 to your computer and use it in GitHub Desktop.
This file contains 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 replace-string-in-rectangle (from-string to-string &optional delimited start end) | |
(interactive | |
(let ((common | |
(query-replace-read-args | |
"Replace string in rectangle" nil))) | |
(list (nth 0 common) (nth 1 common) (nth 2 common) | |
(region-beginning) | |
(region-end)))) | |
(let ((replacement-rectangle | |
(mapcar '(lambda (arg) (replace-in-string arg from-string to-string)) | |
(extract-rectangle start end)))) | |
(delete-rectangle start end) | |
(goto-char start) | |
(insert-rectangle replacement-rectangle))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment