Function: smart-python

smart-python is an autoloaded, interactive and byte-compiled function defined in hmouse-tag.el.

Signature

(smart-python &optional IDENTIFIER NEXT)

Documentation

Jump to the definition of optional Python IDENTIFIER or the one at point.

Optional second arg NEXT means jump to next matching Python tag.

It 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.

First, it tries to display the IDENTIFIER definition with the current xref backend, which may be eglot or etags in which case Hyperbole walks up the current directory tree to find the nearest TAGS file.

If that fails, then see the documentation for smart-python-jedi-to-definition-p for the behavior when the Jedi python identifier server is in use.

If that fails and the OO-Browser extension is available and has been loaded, see the documentation for smart-python-oo-browser for the behavior.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-tag.el
;;;###autoload
(defun smart-python (&optional identifier next)
  "Jump to the definition of optional Python IDENTIFIER or the one at point.
Optional second arg NEXT means jump to next matching Python tag.

It 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.

First, it tries to display the IDENTIFIER definition with
the current `xref' backend, which may be `eglot' or `etags' in which case
Hyperbole walks up the current directory tree to find the nearest TAGS
file.

If that fails, then see the documentation for
`smart-python-jedi-to-definition-p' for the behavior when the Jedi python
identifier server is in use.

If that fails and the OO-Browser extension is available and has been loaded,
see the documentation for `smart-python-oo-browser' for the behavior."
  (interactive)
  (let (err-msg)
    (cond ((condition-case err
	       (progn (smart-python-tag identifier next)
		      t)
	     (t (setq err-msg (concat "(smart-python): " (error-message-string err)))
		nil)))
	  ((smart-python-jedi-to-definition-p))
	  ((fboundp 'python-to-definition)
	   ;; Only fboundp if the OO-Browser has been loaded.
	   (smart-python-oo-browser))
	  (t
	   (error (progn (beep t)
			 (message "%s" (or err-msg
					   (format "(smart-python): `%s' definition not found in identifier lookup/tag tables" identifier)))))))))