diff options
| author | Simeon Simeonov | 2013-09-19 22:27:58 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2013-09-19 22:27:58 +0200 |
| commit | 7bf6712498ad2618bee7bf5b3866fb6da0772339 (patch) | |
| tree | fd4d959c0f1679f2abf5663399d68df0a06472de /.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace | |
| parent | b045e27c545d4027811637193632ec3ea5ef7858 (diff) | |
All snippets imported, init file polished
Diffstat (limited to '.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace')
| -rw-r--r-- | .emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace new file mode 100644 index 0000000..cefcf51 --- /dev/null +++ b/.emacs.d/mysnippets/text-mode/emacs-lisp-mode/find-replace | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #name : find and replace on region | ||
| 2 | #contributor : Xah Lee | ||
| 3 | # -- | ||
| 4 | (defun replace-html-chars-region (start end) | ||
| 5 | "Replace “<” to “<” and other chars in HTML. | ||
| 6 | This works on the current region." | ||
| 7 | (interactive "r") | ||
| 8 | (save-restriction | ||
| 9 | (narrow-to-region start end) | ||
| 10 | (goto-char (point-min)) | ||
| 11 | (while (search-forward "&" nil t) (replace-match "&" nil t)) | ||
| 12 | (goto-char (point-min)) | ||
| 13 | (while (search-forward "<" nil t) (replace-match "<" nil t)) | ||
| 14 | (goto-char (point-min)) | ||
| 15 | (while (search-forward ">" nil t) (replace-match ">" nil t)) | ||
| 16 | ) | ||
| 17 | ) | ||
