diff options
| author | Stefan Monnier | 2026-04-09 14:32:15 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2026-04-09 14:32:15 -0400 |
| commit | fc128826b537fd0b95cedbc03b70e3466dd68ee2 (patch) | |
| tree | c8ffba907527fee594bc0e20cf811b187ee406f3 | |
| parent | dcae1062144d7e0e0ea64f31fb3b9793f918ef76 (diff) | |
| download | emacs-fc128826b537fd0b95cedbc03b70e3466dd68ee2.tar.gz emacs-fc128826b537fd0b95cedbc03b70e3466dd68ee2.zip | |
(elisp--local-variables): Restore point earlier
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Restore
point before calling `elisp--safe-macroexpand-all` in case this
triggers a temporary redisplay.
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 3c3aafcde15..82b80cc16da 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -868,29 +868,30 @@ use of `macroexpand-all' as a way to find the \"underlying raw code\".") | |||
| 868 | 868 | ||
| 869 | (defun elisp--local-variables () | 869 | (defun elisp--local-variables () |
| 870 | "Return a list of locally let-bound variables at point." | 870 | "Return a list of locally let-bound variables at point." |
| 871 | (save-excursion | 871 | (let* ((sexp |
| 872 | (skip-syntax-backward "w_") | 872 | (save-excursion |
| 873 | (let* ((ppss (syntax-ppss)) | 873 | (skip-syntax-backward "w_") |
| 874 | (txt (buffer-substring-no-properties (or (car (nth 9 ppss)) (point)) | 874 | (let* ((ppss (syntax-ppss)) |
| 875 | (or (nth 8 ppss) (point)))) | 875 | (txt (buffer-substring-no-properties |
| 876 | (closer ())) | 876 | (or (car (nth 9 ppss)) (point)) |
| 877 | (dolist (p (nth 9 ppss)) | 877 | (or (nth 8 ppss) (point)))) |
| 878 | (push (cdr (syntax-after p)) closer)) | 878 | (closer |
| 879 | (setq closer (apply #'string closer)) | 879 | (nreverse (mapcar (lambda (p) (cdr (syntax-after p))) |
| 880 | (let* ((sexp (condition-case nil | 880 | (nth 9 ppss))))) |
| 881 | (car (read-from-string | 881 | (condition-case nil |
| 882 | (concat txt "elisp--witness--lisp" closer))) | 882 | (car (read-from-string |
| 883 | ((invalid-read-syntax end-of-file) nil))) | 883 | (concat txt "elisp--witness--lisp" closer))) |
| 884 | (vars (elisp--local-variables-1 | 884 | ((invalid-read-syntax end-of-file) nil))))) |
| 885 | nil (elisp--safe-macroexpand-all sexp)))) | 885 | (vars (elisp--local-variables-1 |
| 886 | (delq nil | 886 | nil (elisp--safe-macroexpand-all sexp)))) |
| 887 | (mapcar (lambda (var) | 887 | (delq nil |
| 888 | (and (symbolp var) | 888 | (mapcar (lambda (var) |
| 889 | (not (string-match (symbol-name var) "\\`[&_]")) | 889 | (and (symbolp var) |
| 890 | ;; Eliminate uninterned vars. | 890 | (not (string-match (symbol-name var) "\\`[&_]")) |
| 891 | (intern-soft var) | 891 | ;; Eliminate uninterned vars. |
| 892 | var)) | 892 | (intern-soft var) |
| 893 | vars)))))) | 893 | var)) |
| 894 | vars)))) | ||
| 894 | 895 | ||
| 895 | (defconst elisp--local-variables-completion-table | 896 | (defconst elisp--local-variables-completion-table |
| 896 | (let ((lastpos nil) (lastvars nil)) | 897 | (let ((lastpos nil) (lastvars nil)) |