Shared publicly  - 
today's fruit

(defun xah-redo-syntax-coloring-html-buffer ()
  "redo all pre lang code syntax coloring in current html page."
  (let (langCode p1-inner p2-inner)
    (goto-char (point-min))
      (re-search-forward "<pre class=\"\\([-A-Za-z0-9]+\\)\">" nil "NOERROR")
      (setq langCode (match-string 1))
      (setq p1-inner (point))
      (backward-char 1)
      (search-backward "</pre>")
      (setq p2-inner (point))
        (narrow-to-region p1-inner p2-inner)
        (xhm-dehtmlize-precode (point-min) (point-max))
        (xhm-htmlize-region (point-min) (point-max) (xhm-langcode-to-major-mode-name langCode xhm-lang-name-map) t)))))

so, i press one button, and the current html file's pre tag of programing lang source code are all regenerated.

why do i want to regenerate? because i'm using several of my own emacs modes for coloring, including xah-elisp-mode, xah-html-mode, xah-css-mode, xah-js-mode, because the default doesn't color many keywords. But in my modes, i constantly add new keywords or tweak how i want them colored. e.g. in javascript should coloring be grouped by keywords, object name, function name, or builtin vs 3rd party, or methods should get one color, etc. So, when i made a change, i sometimes want to update all pages on my site.

the basics is at
Emacs Lisp: Syntax Color Source Code in HTML
Emacs Lisp: Syntax Color Source Code in HTML. Xah Lee. , 2007-10-30 , …, 2012-12-21. Tweet. This page shows you how to write a emacs lisp command to syntax color computer language source code in HTML. Note: if you just want to use the function, download at Emacs: Xah HTML Mode.
Mariano Jara Melagrani's profile photo
Add a comment...