emacs-devel
[Top][All Lists]
Advanced

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

Re: (font-lock-mode 1) does not always force font-lock


From: Alexander Pohoyda
Subject: Re: (font-lock-mode 1) does not always force font-lock
Date: 18 Nov 2003 22:13:34 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

> i think that explicit call to font-lock-mode shd apply to all
> buffers.  instead global-font-lock-mode should check to avoid temp bufs.
> someone want to do it? 

Please excuse me that it took so long.

Here's the patch. Note that it avoids invisible, not temp buffers.


Index: font-core.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/font-core.el,v
retrieving revision 1.23
diff -u -r1.23 font-core.el
--- font-core.el        1 Sep 2003 15:45:12 -0000       1.23
+++ font-core.el        18 Nov 2003 21:02:45 -0000
@@ -149,10 +149,6 @@
 your own function which is called when `font-lock-mode' is toggled via
 `font-lock-function'. "
   nil nil nil
-  ;; Don't turn on Font Lock mode if we don't have a display (we're running a
-  ;; batch job) or if the buffer is invisible (the name starts with a space).
-  (when (or noninteractive (eq (aref (buffer-name) 0) ?\ ))
-    (setq font-lock-mode nil))
   (funcall font-lock-function font-lock-mode)
   ;; Arrange to unfontify this buffer if we change major mode later.
   (if font-lock-mode
@@ -282,8 +278,14 @@
   :group 'font-lock)
 
 (defun turn-on-font-lock-if-enabled ()
-  (unless (and (eq (car-safe font-lock-global-modes) 'not)
-              (memq major-mode (cdr font-lock-global-modes)))
+  (unless (or
+          ;; we don't have a display (we're running a batch job)
+          noninteractive
+          ;; the buffer is invisible (the name starts with a space)
+          (eq (aref (buffer-name) 0) ?\ )
+          ;; this mode is in the list which is negative
+          (and (eq (car-safe font-lock-global-modes) 'not)
+               (memq major-mode (cdr font-lock-global-modes))))
     (let (inhibit-quit)
       (turn-on-font-lock))))
 


-- 
Alexander Pohoyda <address@hidden>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44




reply via email to

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