From: Eshel Yaron Date: Thu, 26 Sep 2024 12:02:53 +0000 (+0200) Subject: ; Drop 'elisp--local-variables-completion-table' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4aeb46354c63fd95acb266b198548e8531aa813b;p=emacs.git ; Drop 'elisp--local-variables-completion-table' --- diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 71ac4941844..0d6d9eac26a 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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))))