Function: elisp-local-references

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

Signature

(elisp-local-references POS)

Documentation

Return references to local variable at POS as (BEG . LEN) cons cells.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp-local-references (pos)
  "Return references to local variable at POS as (BEG . LEN) cons cells."
  (let (all cur)
    (save-excursion
      (goto-char pos)
      (beginning-of-defun)
      (elisp-scope-analyze-form
       (lambda (_role beg _sym id &optional _def)
         (let* ((end (progn (goto-char beg) (read (current-buffer)) (point)))
                (len (- end beg)))
           (when (<= beg pos end) (setq cur id))
           (when id (setf (alist-get beg all) (list len id)))))))
    (seq-keep
     (pcase-lambda (`(,beg ,len ,id)) (when (equal id cur) (cons beg len)))
     all)))