emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c0c57f8: Move some Elisp-specific code from lisp-mo


From: Stefan Monnier
Subject: [Emacs-diffs] master c0c57f8: Move some Elisp-specific code from lisp-mode.el to elisp-mode.el
Date: Wed, 15 Apr 2015 20:50:22 +0000

branch: master
commit c0c57f8b36d4472296f9bc237a16b9876488472c
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    Move some Elisp-specific code from lisp-mode.el to elisp-mode.el
    
    * lisp/emacs-lisp/lisp-mode.el (lisp--el-font-lock-flush-elisp-buffers):
    Move to elisp-mode.el.
    (lisp-mode-variables): (Re)move elisp-specific settings.
    
    * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Add settings removed
    from lisp-mode-variables.
    (elisp--font-lock-flush-elisp-buffers): New function, moved from
    lisp-mode.el.
---
 lisp/emacs-lisp/lisp-mode.el |   16 +---------------
 lisp/progmodes/elisp-mode.el |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 45d5a0b..26a21d5 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -218,6 +218,7 @@
                          (< (point) pos))))))))))
 
 (defun lisp--el-match-keyword (limit)
+  ;; FIXME: Move to elisp-mode.el.
   (catch 'found
     (while (re-search-forward "(\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>" limit t)
       (let ((sym (intern-soft (match-string 1))))
@@ -228,17 +229,6 @@
                              (match-beginning 0)))))
          (throw 'found t))))))
 
-(defun lisp--el-font-lock-flush-elisp-buffers (&optional file)
-  ;; Don't flush during load unless called from after-load-functions.
-  ;; In that case, FILE is non-nil.  It's somehow strange that
-  ;; load-in-progress is t when an after-load-function is called since
-  ;; that should run *after* the load...
-  (when (or (not load-in-progress) file)
-    (dolist (buf (buffer-list))
-      (with-current-buffer buf
-       (when (derived-mode-p 'emacs-lisp-mode)
-         (font-lock-flush))))))
-
 (pcase-let
     ((`(,vdefs ,tdefs
         ,el-defs-re ,cl-defs-re
@@ -583,10 +573,6 @@ font-lock keywords will not be case sensitive."
          (font-lock-syntactic-face-function
           . lisp-font-lock-syntactic-face-function)))
   (setq-local prettify-symbols-alist lisp--prettify-symbols-alist)
-  (when elisp
-    (add-hook 'after-load-functions #'lisp--el-font-lock-flush-elisp-buffers)
-    (setq-local electric-pair-text-pairs
-                (cons '(?\` . ?\') electric-pair-text-pairs)))
   (setq-local electric-pair-skip-whitespace 'chomp)
   (setq-local electric-pair-open-newline-between-pairs nil))
 
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 29f1ee9..29f1c9a 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -230,6 +230,9 @@ Blank lines separate paragraphs.  Semicolons start comments.
   (defvar xref-find-function)
   (defvar xref-identifier-completion-table-function)
   (lisp-mode-variables nil nil 'elisp)
+  (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers)
+  (setq-local electric-pair-text-pairs
+              (cons '(?\` . ?\') electric-pair-text-pairs))
   (setq imenu-case-fold-search nil)
   (add-function :before-until (local 'eldoc-documentation-function)
                 #'elisp-eldoc-documentation-function)
@@ -239,6 +242,24 @@ Blank lines separate paragraphs.  Semicolons start 
comments.
   (add-hook 'completion-at-point-functions
             #'elisp-completion-at-point nil 'local))
 
+;; Font-locking support.
+
+(defun elisp--font-lock-flush-elisp-buffers (&optional file)
+  ;; FIXME: Aren't we only ever called from after-load-functions?
+  ;; Don't flush during load unless called from after-load-functions.
+  ;; In that case, FILE is non-nil.  It's somehow strange that
+  ;; load-in-progress is t when an after-load-function is called since
+  ;; that should run *after* the load...
+  (when (or (not load-in-progress) file)
+    ;; FIXME: If the loaded file did not define any macros, there shouldn't
+    ;; be any need to font-lock-flush all the Elisp buffers.
+    (dolist (buf (buffer-list))
+      (with-current-buffer buf
+       (when (derived-mode-p 'emacs-lisp-mode)
+          ;; So as to take into account new macros that may have been defined
+          ;; by the just-loaded file.
+         (font-lock-flush))))))
+
 ;;; Completion at point for Elisp
 
 (defun elisp--local-variables-1 (vars sexp)



reply via email to

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