emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-lock-fontify-block


From: Gregory Heytings
Subject: Re: font-lock-fontify-block
Date: Fri, 12 Mar 2021 18:19:47 +0000


What I proposed was under the assumption that font-lock-fontify-block was (about to be) obsolete(d). But you are correct, I got the condition wrong:

I don't know: show us the docstring and then maybe we'll be able to tell when the code is wrong.


Here it is (it's a kind of "dwim" command):

(defun font-lock-update (&optional arg)
  "Updates the syntax highlighting in this buffer.
Enable Font Lock mode if it is disabled.
Otherwise, refontify the accessible portion of the buffer.
With prefix ARG, toggle Font Lock mode."
  (interactive "P")
  (save-mark-and-excursion
    (if (and (not arg) font-lock-mode)
        (font-lock-fontify-region (point-min) (point-max))
      (font-lock-unfontify-region (point-min) (point-max))
      (font-lock-mode 'toggle))))
(global-set-key (kbd "C-x x f") 'font-lock-update)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]