emacs-diffs
[Top][All Lists]
Advanced

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

master 39f16a7: Revert "Remove font-lock toggle from font-lock-update"


From: Lars Ingebrigtsen
Subject: master 39f16a7: Revert "Remove font-lock toggle from font-lock-update"
Date: Wed, 24 Mar 2021 12:02:40 -0400 (EDT)

branch: master
commit 39f16a7d396a9e8299b0447cdf87a07a4fbf4d53
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Revert "Remove font-lock toggle from font-lock-update"
    
    This reverts commit 23995414fec483287e7fb9c9a279483319f9fc54.
    
    The subject is under discussion.
---
 lisp/font-lock.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 3105242..82915d8 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1120,13 +1120,17 @@ portion of the buffer."
     (funcall font-lock-ensure-function
              (or beg (point-min)) (or end (point-max)))))
 
-(defun font-lock-update ()
-  "Refontify the accessible portion of the buffer.
-Unconditionally activate `font-lock-mode'."
-  (interactive)
-  (unless font-lock-mode (font-lock-mode 1))
+(defun font-lock-update (&optional arg)
+  "Updates the syntax highlighting in this buffer.
+Refontify the accessible portion of this buffer, or enable Font Lock mode
+in this buffer if it is currently disabled.  With prefix ARG, toggle Font
+Lock mode."
+  (interactive "P")
   (save-excursion
-    (font-lock-fontify-region (point-min) (point-max))))
+    (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))))
 
 (defun font-lock-default-fontify-buffer ()
   "Fontify the whole buffer using `font-lock-fontify-region-function'."



reply via email to

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