emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-lisp-mode and find-tag


From: Ivan Kanis
Subject: Re: emacs-lisp-mode and find-tag
Date: Fri, 20 Jun 2014 20:53:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.91 (gnu/linux)

June, 20 at 13:35 Stefan wrote:

> I'm more interested in introducing generic code, which relies on
> a `find-tag-function` hook to do the work of finding the definition.

I have used the following two functions for a while now. The second I
have bound to M-, to pop back like in slime. (The default M-* is awkward
IMO).

I bind the functions in the elisp-mode, help-mode and the debugger-mode.

They are not generic though...

(defun ivan-elisp-find-object ()
  "Jump to definition of function or variable near point."
  (interactive)
  (let ((object (intern (current-word)))
        (insert (lambda() (ring-insert ivan-elisp-mark-ring (point-marker)))))
    (cond ((functionp object)
           (funcall insert)
           (find-function object))
          ((boundp object)
           (funcall insert)
           (find-variable object))
          (t (message "symbol %s not found" (current-word))))))

(defun ivan-elisp-pop-mark ()
  "Pop to the previous location before jumping to a definition."
  (interactive)
  (if (ring-empty-p ivan-elisp-mark-ring)
      (message "No previous locations")
    (let ((marker (ring-remove ivan-elisp-mark-ring 0)))
      (switch-to-buffer (or (marker-buffer marker)
                            (message  "The marked buffer has been deleted")))
      (goto-char (marker-position marker))
      (set-marker marker nil nil))))


-- 
I have been at my book, and am now past the craggy paths of study, and
come to the flowery plains of honour and reputation.
    -- Ben Jonson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]