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.
This commit is contained in:
parent
59fd76c178
commit
c0c57f8b36
2 changed files with 22 additions and 15 deletions
|
@ -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))
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue