Function: helpful--variable-defined-at-point

helpful--variable-defined-at-point is a byte-compiled function defined in helpful.el.

Signature

(helpful--variable-defined-at-point)

Documentation

Return the variable defined in the form enclosing point.

Source Code

;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--variable-defined-at-point ()
  "Return the variable defined in the form enclosing point."
  ;; TODO: do the same thing if point is just before a top-level form.
  (save-excursion
    (save-restriction
      (widen)
      (let* ((ppss (syntax-ppss))
             (sexp-start (nth 1 ppss))
             sexp)
        (when sexp-start
          (goto-char sexp-start)
          (setq sexp (condition-case nil
                         (read (current-buffer))
                       (error nil)))
          (when (memq (car-safe sexp)
                      (list 'defvar 'defvar-local 'defcustom 'defconst))
            (nth 1 sexp)))))))