]> git.eshelyaron.com Git - emacs.git/commitdiff
* hi-lock.el (hi-lock--inhibit-font-lock-hook): New var.
authorChong Yidong <cyd@stupidchicken.com>
Thu, 23 Apr 2009 01:34:54 +0000 (01:34 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Thu, 23 Apr 2009 01:34:54 +0000 (01:34 +0000)
(hi-lock-set-pattern, hi-lock-font-lock-hook): Use it (Bug#3068).

lisp/ChangeLog
lisp/hi-lock.el
lisp/startup.el

index 614615f814333f247790c5d7712dca0a481d5669..e26549f32cb6915d24dc9c49b433284ecfaf5a18 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-23  Chong Yidong  <cyd@stupidchicken.com>
+
+       * hi-lock.el (hi-lock--inhibit-font-lock-hook): New var.
+       (hi-lock-set-pattern, hi-lock-font-lock-hook): Use it (Bug#3068).
+
 2009-04-21  Martin Rudalics  <rudalics@gmx.at>
 
        * diff-mode.el (diff-find-source-location): Don't call
index 3bc8c8b1abd5c1126aaa5bd57cb759b565ad3a0b..672f399d9a16b3cc4c4be110bda53bda122c6fb6 100644 (file)
@@ -564,9 +564,18 @@ not suitable."
            'face-name-history
           (cdr hi-lock-face-defaults))))
 
+(defvar hi-lock--inhibit-font-lock-hook nil
+  "Inhibit the action of `hi-lock-font-lock-hook'.
+This is used by `hi-lock-set-pattern'.")
+
 (defun hi-lock-set-pattern (regexp face)
   "Highlight REGEXP with face FACE."
-  (let ((pattern (list regexp (list 0 (list 'quote face) t))))
+  (let ((pattern (list regexp (list 0 (list 'quote face) t)))
+       ;; The call to `font-lock-add-keywords' below might disable
+       ;; and re-enable font-lock mode.  If so, we don't want
+       ;; `hi-lock-font-lock-hook' to run.  This can be removed once
+       ;; Bug#635 is fixed. -- cyd
+       (hi-lock--inhibit-font-lock-hook t))
     (unless (member pattern hi-lock-interactive-patterns)
       (font-lock-add-keywords nil (list pattern) t)
       (push pattern hi-lock-interactive-patterns)
@@ -632,11 +641,12 @@ not suitable."
 
 (defun hi-lock-font-lock-hook ()
   "Add hi-lock patterns to font-lock's."
-  (if font-lock-mode
-      (progn
-       (font-lock-add-keywords nil hi-lock-file-patterns t)
-       (font-lock-add-keywords nil hi-lock-interactive-patterns t))
-    (hi-lock-mode -1)))
+  (unless hi-lock--inhibit-font-lock-hook
+    (if font-lock-mode
+       (progn
+         (font-lock-add-keywords nil hi-lock-file-patterns t)
+         (font-lock-add-keywords nil hi-lock-interactive-patterns t))
+      (hi-lock-mode -1))))
 
 (defvar hi-lock-string-serialize-hash
   (make-hash-table :test 'equal)
index 7a1f9dc392d9157680410b9bbaa6c83dd3217a79..e2929e08b8353776ffdda3e627d2e06295fed560 100644 (file)
@@ -499,7 +499,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
                     (delete (concat "PWD=" pwd)
                             process-environment)))))
     (setq default-directory (abbreviate-file-name default-directory))
-    (let ((menubar-bindings-done nil))
+    (let ((menubar-bindings-done nil)
+         (old-face-font-rescale-alist face-font-rescale-alist))
       (unwind-protect
          (command-line)
        ;; Do this again, in case .emacs defined more abbreviations.
@@ -540,6 +541,11 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
                  (not (and initial-window-system
                            (not noninteractive)
                            (not (eq initial-window-system 'pc)))))
+         ;; If face-font-rescale-alist has changed, reload the
+         ;; default font.
+         (unless (eq face-font-rescale-alist
+                     old-face-font-rescale-alist)
+           (set-face-attribute 'default nil :font (font-spec)))
          ;; Modify the initial frame based on what .emacs puts into
          ;; ...-frame-alist.
          (if (fboundp 'frame-notice-user-settings)