Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
632 B

4 years ago
  1. # -*- mode: snippet -*-
  2. # contributor: Xah Lee (XahLee.org)
  3. # name: find and replace on region
  4. # key: x-find-replace
  5. # --
  6. (defun replace-html-chars-region (start end)
  7. "Replace “<” to “&lt;” and other chars in HTML.
  8. This works on the current region."
  9. (interactive "r")
  10. (save-restriction
  11. (narrow-to-region start end)
  12. (goto-char (point-min))
  13. (while (search-forward "&" nil t) (replace-match "&amp;" nil t))
  14. (goto-char (point-min))
  15. (while (search-forward "<" nil t) (replace-match "&lt;" nil t))
  16. (goto-char (point-min))
  17. (while (search-forward ">" nil t) (replace-match "&gt;" nil t))
  18. )
  19. )