annotate elpa/yasnippet-0.9.1/snippets/emacs-lisp-mode/x-find-replace.yasnippet @ 141:ee4b6191b61e

packages: update yasnippet and deps
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 20 Apr 2016 13:40:19 -0400
parents elpa/yasnippet-0.8.0/snippets/emacs-lisp-mode/x-find-replace.yasnippet@156cbb54f344
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
1 # contributor: Xah Lee (XahLee.org)
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
2 # name: find and replace on region
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
3 # key: x-find-replace
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
4 # --
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
5 (defun replace-html-chars-region (start end)
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
6 "Replace “<” to “&lt;” and other chars in HTML.
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
7 This works on the current region."
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
8 (interactive "r")
141
ee4b6191b61e packages: update yasnippet and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 98
diff changeset
9 (save-restriction
98
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
10 (narrow-to-region start end)
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
11 (goto-char (point-min))
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
12 (while (search-forward "&" nil t) (replace-match "&amp;" nil t))
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
13 (goto-char (point-min))
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
14 (while (search-forward "<" nil t) (replace-match "&lt;" nil t))
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
15 (goto-char (point-min))
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
16 (while (search-forward ">" nil t) (replace-match "&gt;" nil t))
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
17 )
156cbb54f344 Add elpy and deps
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
diff changeset
18 )