Function: elisp--local-variables

elisp--local-variables is a byte-compiled function defined in elisp-mode.el.gz.

Signature

(elisp--local-variables)

Documentation

Return a list of locally let-bound variables at point.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp--local-variables ()
  "Return a list of locally let-bound variables at point."
  (let* ((sexp
          (save-excursion
            (skip-syntax-backward "w_")
            (let* ((ppss (syntax-ppss))
                   (txt (buffer-substring-no-properties
                         (or (car (nth 9 ppss)) (point))
                         (or (nth 8 ppss) (point))))
                   (closer
                    (nreverse (mapcar (lambda (p) (cdr (syntax-after p)))
                                      (nth 9 ppss)))))
              (condition-case nil
                  (car (read-from-string
                        (concat txt "elisp--witness--lisp" closer)))
                ((invalid-read-syntax end-of-file) nil)))))
         (vars (elisp--local-variables-1
                nil (elisp--safe-macroexpand-all sexp))))
    (delq nil
          (mapcar (lambda (var)
                    (and (symbolp var)
                         (not (string-match (symbol-name var) "\\`[&_]"))
                         ;; Eliminate uninterned vars.
                         (intern-soft var)
                         var))
                  vars))))