DWIM find-function kind of affair.
| ;; Interactively invoke tom/find-definition-of-elisp-symbol with point on an elisp symbol. | |
| (defvar tom/find-definition-of-elisp-symbol-history '()) | |
| (defvar tom/find-definition-of-elisp-symbol-old-marker nil) | |
| (defun tom/find-definition-of-elisp-symbol-add-marker () | |
| (when tom/find-definition-of-elisp-symbol-old-marker | |
| (ring-insert find-tag-marker-ring tom/find-definition-of-elisp-symbol-old-marker) | |
| (setq tom/find-definition-of-elisp-symbol-old-marker nil))) | |
| (defun tom/find-definition-of-elisp-symbol () | |
| (interactive) | |
| (let* ((unksym (grep-tag-default)) | |
| (funsym (function-called-at-point)) | |
| (varsym (variable-at-point))) | |
| (add-hook 'find-function-after-hook 'tom/find-definition-of-elisp-symbol-add-marker) | |
| (setq tom/find-definition-of-elisp-symbol-old-marker (point-marker)) | |
| (cond | |
| ((equal (symbol-name funsym) unksym) | |
| (find-function-do-it funsym nil 'switch-to-buffer)) | |
| ((not (equal varsym 0)) | |
| (find-function-do-it varsym 'defvar 'switch-to-buffer))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment