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
(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))))