]> git.eshelyaron.com Git - emacs.git/commitdiff
; Drop 'elisp--local-variables-completion-table'
authorEshel Yaron <me@eshelyaron.com>
Thu, 26 Sep 2024 12:02:53 +0000 (14:02 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 26 Sep 2024 12:02:53 +0000 (14:02 +0200)
lisp/progmodes/elisp-mode.el

index 71ac49418445194c2eefc05825bb394b0a2cdd7b..0d6d9eac26aeee0aa3e46d9ebb10677c3846c0c0 100644 (file)
@@ -594,27 +594,6 @@ use of `macroexpand-all' as a way to find the \"underlying raw code\".")
                              var))
                       vars))))))
 
-(defvar elisp--local-variables-completion-table
-  ;; Use `defvar' rather than `defconst' since defconst would purecopy this
-  ;; value, which would doubly fail: it would fail because purecopy can't
-  ;; handle the recursive bytecode object, and it would fail because it would
-  ;; move `lastpos' and `lastvars' to pure space where they'd be immutable!
-  (let ((lastpos nil) (lastvars nil))
-    (letrec ((hookfun (lambda ()
-                        (setq lastpos nil)
-                        (remove-hook 'post-command-hook hookfun))))
-      (completion-table-dynamic
-       (lambda (_string)
-         (save-excursion
-           (skip-syntax-backward "_w")
-           (let ((newpos (cons (point) (current-buffer))))
-             (unless (equal lastpos newpos)
-               (add-hook 'post-command-hook hookfun)
-               (setq lastpos newpos)
-               (setq lastvars
-                     (mapcar #'symbol-name (elisp--local-variables))))))
-         lastvars)))))
-
 (defun elisp--expect-function-p (pos)
   "Return non-nil if the symbol at position POS is expected to be a function."
   (or
@@ -767,7 +746,9 @@ in `completion-at-point-functions' (which see)."
                                                   (throw 'sym-type type)))
                                               (current-buffer))
                                        nil))
-                            ((variable constant) #'elisp--shorthand-aware-boundp)
+                            ((variable constant) (let ((local-vars (elisp--local-variables)))
+                                                   (lambda (sym) (or (elisp--shorthand-aware-boundp sym)
+                                                                     (memq sym local-vars)))))
                             ((function macro special-form top-level) #'elisp--shorthand-aware-fboundp)
                             ((nil) (lambda (sym)
                                      (let ((sym (intern-soft (symbol-name sym))))