aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-04-15 16:50:17 -0400
committerStefan Monnier2015-04-15 16:50:17 -0400
commitc0c57f8b36d4472296f9bc237a16b9876488472c (patch)
tree12cb956e9134fd8567991c2e8502e0c7f2ae9ea0
parent59fd76c178ada8a8b3eb5e3e00609001e9f0195f (diff)
downloademacs-c0c57f8b36d4472296f9bc237a16b9876488472c.tar.gz
emacs-c0c57f8b36d4472296f9bc237a16b9876488472c.zip
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.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el16
-rw-r--r--lisp/progmodes/elisp-mode.el21
2 files changed, 22 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 45d5a0b410c..26a21d52370 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -218,6 +218,7 @@
218 (< (point) pos)))))))))) 218 (< (point) pos))))))))))
219 219
220(defun lisp--el-match-keyword (limit) 220(defun lisp--el-match-keyword (limit)
221 ;; FIXME: Move to elisp-mode.el.
221 (catch 'found 222 (catch 'found
222 (while (re-search-forward "(\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>" limit t) 223 (while (re-search-forward "(\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>" limit t)
223 (let ((sym (intern-soft (match-string 1)))) 224 (let ((sym (intern-soft (match-string 1))))
@@ -228,17 +229,6 @@
228 (match-beginning 0))))) 229 (match-beginning 0)))))
229 (throw 'found t)))))) 230 (throw 'found t))))))
230 231
231(defun lisp--el-font-lock-flush-elisp-buffers (&optional file)
232 ;; Don't flush during load unless called from after-load-functions.
233 ;; In that case, FILE is non-nil. It's somehow strange that
234 ;; load-in-progress is t when an after-load-function is called since
235 ;; that should run *after* the load...
236 (when (or (not load-in-progress) file)
237 (dolist (buf (buffer-list))
238 (with-current-buffer buf
239 (when (derived-mode-p 'emacs-lisp-mode)
240 (font-lock-flush))))))
241
242(pcase-let 232(pcase-let
243 ((`(,vdefs ,tdefs 233 ((`(,vdefs ,tdefs
244 ,el-defs-re ,cl-defs-re 234 ,el-defs-re ,cl-defs-re
@@ -583,10 +573,6 @@ font-lock keywords will not be case sensitive."
583 (font-lock-syntactic-face-function 573 (font-lock-syntactic-face-function
584 . lisp-font-lock-syntactic-face-function))) 574 . lisp-font-lock-syntactic-face-function)))
585 (setq-local prettify-symbols-alist lisp--prettify-symbols-alist) 575 (setq-local prettify-symbols-alist lisp--prettify-symbols-alist)
586 (when elisp
587 (add-hook 'after-load-functions #'lisp--el-font-lock-flush-elisp-buffers)
588 (setq-local electric-pair-text-pairs
589 (cons '(?\` . ?\') electric-pair-text-pairs)))
590 (setq-local electric-pair-skip-whitespace 'chomp) 576 (setq-local electric-pair-skip-whitespace 'chomp)
591 (setq-local electric-pair-open-newline-between-pairs nil)) 577 (setq-local electric-pair-open-newline-between-pairs nil))
592 578
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.
230 (defvar xref-find-function) 230 (defvar xref-find-function)
231 (defvar xref-identifier-completion-table-function) 231 (defvar xref-identifier-completion-table-function)
232 (lisp-mode-variables nil nil 'elisp) 232 (lisp-mode-variables nil nil 'elisp)
233 (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers)
234 (setq-local electric-pair-text-pairs
235 (cons '(?\` . ?\') electric-pair-text-pairs))
233 (setq imenu-case-fold-search nil) 236 (setq imenu-case-fold-search nil)
234 (add-function :before-until (local 'eldoc-documentation-function) 237 (add-function :before-until (local 'eldoc-documentation-function)
235 #'elisp-eldoc-documentation-function) 238 #'elisp-eldoc-documentation-function)
@@ -239,6 +242,24 @@ Blank lines separate paragraphs. Semicolons start comments.
239 (add-hook 'completion-at-point-functions 242 (add-hook 'completion-at-point-functions
240 #'elisp-completion-at-point nil 'local)) 243 #'elisp-completion-at-point nil 'local))
241 244
245;; Font-locking support.
246
247(defun elisp--font-lock-flush-elisp-buffers (&optional file)
248 ;; FIXME: Aren't we only ever called from after-load-functions?
249 ;; Don't flush during load unless called from after-load-functions.
250 ;; In that case, FILE is non-nil. It's somehow strange that
251 ;; load-in-progress is t when an after-load-function is called since
252 ;; that should run *after* the load...
253 (when (or (not load-in-progress) file)
254 ;; FIXME: If the loaded file did not define any macros, there shouldn't
255 ;; be any need to font-lock-flush all the Elisp buffers.
256 (dolist (buf (buffer-list))
257 (with-current-buffer buf
258 (when (derived-mode-p 'emacs-lisp-mode)
259 ;; So as to take into account new macros that may have been defined
260 ;; by the just-loaded file.
261 (font-lock-flush))))))
262
242;;; Completion at point for Elisp 263;;; Completion at point for Elisp
243 264
244(defun elisp--local-variables-1 (vars sexp) 265(defun elisp--local-variables-1 (vars sexp)