diff options
| author | Noam Postavsky | 2019-07-07 12:22:37 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2019-07-18 20:06:27 -0400 |
| commit | 8f54998827e416fe1fca7bc384bf0a6281b73f1b (patch) | |
| tree | 2a592d0283230889b2517450897a516795959559 | |
| parent | daf5c4309f9fc173c51a5d0bcbc904cbae96ee77 (diff) | |
| download | emacs-8f54998827e416fe1fca7bc384bf0a6281b73f1b.tar.gz emacs-8f54998827e416fe1fca7bc384bf0a6281b73f1b.zip | |
Don't load elec-pair in elisp-mode (Bug#36539)
* lisp/progmodes/elisp-mode.el (emacs-lisp-set-electric-text-pairs):
New function.
(emacs-lisp-mode): Add it to electric-pair-mode-hook, if elec-pair
hasn't been loaded yet.
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 16851c0d826..da7a731ec22 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -219,6 +219,18 @@ Comments in the form will be lost." | |||
| 219 | :type 'hook | 219 | :type 'hook |
| 220 | :group 'lisp) | 220 | :group 'lisp) |
| 221 | 221 | ||
| 222 | (defun emacs-lisp-set-electric-text-pairs () | ||
| 223 | "Set `electric-pair-text-pairs' for all `emacs-lisp-mode' buffers." | ||
| 224 | (defvar electric-pair-text-pairs) | ||
| 225 | (let ((elisp-pairs (append '((?\` . ?\') (?‘ . ?’)) | ||
| 226 | electric-pair-text-pairs))) | ||
| 227 | (save-current-buffer | ||
| 228 | (dolist (buf (buffer-list)) | ||
| 229 | (set-buffer buf) | ||
| 230 | (when (derived-mode-p 'emacs-lisp-mode) | ||
| 231 | (setq-local electric-pair-text-pairs elisp-pairs))))) | ||
| 232 | (remove-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs)) | ||
| 233 | |||
| 222 | ;;;###autoload | 234 | ;;;###autoload |
| 223 | (define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" | 235 | (define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" |
| 224 | "Major mode for editing Lisp code to run in Emacs. | 236 | "Major mode for editing Lisp code to run in Emacs. |
| @@ -231,12 +243,12 @@ Blank lines separate paragraphs. Semicolons start comments. | |||
| 231 | (defvar project-vc-external-roots-function) | 243 | (defvar project-vc-external-roots-function) |
| 232 | (lisp-mode-variables nil nil 'elisp) | 244 | (lisp-mode-variables nil nil 'elisp) |
| 233 | (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers) | 245 | (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers) |
| 234 | (unless noninteractive | 246 | (if (boundp 'electric-pair-text-pairs) |
| 235 | (require 'elec-pair) | 247 | (setq-local electric-pair-text-pairs |
| 236 | (defvar electric-pair-text-pairs) | 248 | (append '((?\` . ?\') (?‘ . ?’)) |
| 237 | (setq-local electric-pair-text-pairs | 249 | electric-pair-text-pairs)) |
| 238 | (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs)) | 250 | (add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs)) |
| 239 | (setq-local electric-quote-string t)) | 251 | (setq-local electric-quote-string t) |
| 240 | (setq imenu-case-fold-search nil) | 252 | (setq imenu-case-fold-search nil) |
| 241 | (add-function :before-until (local 'eldoc-documentation-function) | 253 | (add-function :before-until (local 'eldoc-documentation-function) |
| 242 | #'elisp-eldoc-documentation-function) | 254 | #'elisp-eldoc-documentation-function) |