]> git.eshelyaron.com Git - emacs.git/commitdiff
(turn-on-font-lock-if-desired):
authorRichard M. Stallman <rms@gnu.org>
Fri, 19 Oct 2007 17:27:58 +0000 (17:27 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 19 Oct 2007 17:27:58 +0000 (17:27 +0000)
Renamed from `turn-on-font-lock-if-enabled'.
Fully obey `font-lock-global-modes'.

lisp/ChangeLog
lisp/font-core.el

index 5fd75965a61d2692543a60d90a3e58624a4bef30..cba2388afd90895baa1f7d6ba9d4588212cf62d6 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-19  Richard Stallman  <rms@gnu.org>
+
+       * font-core.el (turn-on-font-lock-if-desired):
+       Renamed from `turn-on-font-lock-if-enabled'.
+       Fully obey `font-lock-global-modes'.
+
 2007-10-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * diff-mode.el (diff-fine-highlight-preproc): Stick to minimal changes
index 7d7a65e83cc95168efc2268b45af90d45a48f06b..b97550d26937f3e1824fae51624e20efb51781c9 100644 (file)
@@ -234,7 +234,7 @@ this function onto `change-major-mode-hook'."
 ;; hook is run, the major mode is in the process of being changed and we do not
 ;; know what the final major mode will be.  So, `font-lock-change-major-mode'
 ;; only (a) notes the name of the current buffer, and (b) adds our function
-;; `turn-on-font-lock-if-enabled' to the hook variables
+;; `turn-on-font-lock-if-desired' to the hook variables
 ;; `after-change-major-mode-hook' and `post-command-hook' (for modes
 ;; that do not yet run `after-change-major-mode-hook').  By the time
 ;; the functions on the first of these hooks to be run are run, the new major
@@ -281,14 +281,17 @@ means that Font Lock mode is turned on for buffers in C and C++ modes only."
                      (repeat :inline t (symbol :tag "mode"))))
   :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)))
+(defun turn-on-font-lock-if-desired ()
+  (when (cond ((eq font-lock-global-modes t)
+              t)
+             ((eq (car-safe font-lock-global-modes) 'not)
+              (not (memq major-mode (cdr font-lock-global-modes))))
+             (t (memq major-mode (cdr font-lock-global-modes))))
     (let (inhibit-quit)
       (turn-on-font-lock))))
 
 (define-globalized-minor-mode global-font-lock-mode
-  font-lock-mode turn-on-font-lock-if-enabled
+  font-lock-mode turn-on-font-lock-if-desired
   :extra-args (dummy)
   :initialize 'custom-initialize-safe-default
   :init-value (not (or noninteractive emacs-basic-display))