Function: smart-lisp

smart-lisp is an interactive and byte-compiled function defined in hmouse-tag.el.

Signature

(smart-lisp &optional SHOW-DOC)

Documentation

Jump to the definition of any selected Lisp identifier or optionally SHOW-DOC.

Assume caller has checked that (smart-emacs-lisp-mode-p) is true.

If on an Emacs Lisp require, load, or autoload clause and the find-library function from the "load-library" package has been loaded, this jumps to the library source whenever possible.

Otherwise, if a definition for the identifier is found within a TAGS file in the current directory or any of its ancestor directories, this jumps to the definition. Supports Hyperbole implicit button types and action types.

With optional SHOW-DOC flag, show documentation for the tag at point rather than displaying its source code definition. In this case, tag must be a bound or fbound symbol or it is ignored.

This command assumes that its caller has already checked that the key was pressed in an appropriate buffer and has moved the cursor to the selected buffer.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-tag.el
(defun smart-lisp (&optional show-doc)
  "Jump to the definition of any selected Lisp identifier or optionally SHOW-DOC.

Assume caller has checked that (smart-emacs-lisp-mode-p) is true.

If on an Emacs Lisp require, load, or autoload clause and the
`find-library' function from the \"load-library\" package has
been loaded, this jumps to the library source whenever possible.

Otherwise, if a definition for the identifier is found within a TAGS
file in the current directory or any of its ancestor directories, this
jumps to the definition.  Supports Hyperbole implicit button types and
action types.

With optional SHOW-DOC flag, show documentation for the tag at point
rather than displaying its source code definition.  In this case, tag
must be a bound or fbound symbol or it is ignored.

This command assumes that its caller has already checked that the key was
pressed in an appropriate buffer and has moved the cursor to the selected
buffer."

  (interactive)
  (unless
      ;; Handle Emacs Lisp `require', `load', and `autoload' clauses.
      (let ((opoint (point))
	    type
	    name
	    lib)
	(setq lib (and (search-backward "\(" nil t)
		       (or
			;; load with a filename
			(looking-at "(\\(load\\)[ \t]+\\(\\)\"\\([^][() \t\n\r`'\"]+\\)")
			;; autoload or require with a name and filename
			(looking-at "(\\(autoload\\|require\\)[ \t]+'\\([^][() \t\n\r`'\"]+\\)[ \t\n\r]+\"\\([^][() \t\n\r`'\"]+\\)")
			;; require without a separate filename
			(looking-at "(\\(require\\)\\(\\)[ \t]+'\\([^][() \t\n\r`'\"]+\\)"))))
	(goto-char opoint)
	(when lib
	  (setq type (match-string-no-properties 1)
		name (match-string-no-properties 2)
		lib (match-string-no-properties 3))
	  (hpath:display-buffer (current-buffer))
	  (find-library lib)
	  (goto-char (point-min))
	  (when (equal type "autoload")
	    ;; Ignore defgroup matches
	    (if (re-search-forward
		 (format "^[; \t]*(def.[^r][^ \t\n\r]*[ \t]+%s[ \t\n\r]" (regexp-quote name))
		 nil t)
		(goto-char (match-beginning 0))
	      (error "(smart-lisp): Found autoload library but no definition for `%s'" name)))
	  t))
    (smart-lisp-find-tag nil show-doc)))