From c0c57f8b36d4472296f9bc237a16b9876488472c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 15 Apr 2015 16:50:17 -0400 Subject: 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/progmodes/elisp-mode.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lisp/progmodes') diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 29f1ee9a98c..29f1c9aeb6b 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) -- cgit v1.2.1