Emacs Lisp: strip-html by Sacha Chua, remove those tags!

Emacs Lisp: strip-html by Sacha Chua, remove those tags!

Sacha Chua is wonderful woman that likes GNU Emacs, notes, she has her thoughts well organized and lives a happy life. Once I had to find the strip-html function and it was just there, on her website, thank you Sacha!

;; http://sachachua.com/notebook/emacs/small-functions.el
(defun strip-html ()
  "Remove HTML tags from the current buffer, 
   (this will affect the whole buffer regardless of the restrictions in effect)."
  (interactive "*")
  (save-excursion
    (save-restriction
      (widen)
      (goto-char (point-min))
      (while (re-search-forward "<[^<]*>" (point-max) t)
    (replace-match "\\1"))
      (goto-char (point-min))
      (replace-string "&copy;" "(c)")
      (goto-char (point-min))
      (replace-string "&amp;" "&")
      (goto-char (point-min))
      (replace-string "&lt;" "<")
      (goto-char (point-min))
      (replace-string "&gt;" ">")
      (goto-char (point-min)))))

So many times I read website of Sacha Chua and her GNU Emacs News

Related pages

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: