unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Kanis <ivan@kanis.fr>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Josh <josh@foxtail.org>, ams@gnu.org, emacs-devel <emacs-devel@gnu.org>
Subject: Re: emacs-lisp-mode and find-tag
Date: Fri, 20 Jun 2014 20:53:28 +0200	[thread overview]
Message-ID: <87lhsrtntj.fsf@kanis.fr> (raw)
In-Reply-To: <jwv61jvo6c7.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 20 Jun 2014 13:35:07 -0400")

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	other threads:[~2014-06-20 18:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 12:32 emacs-lisp-mode and find-tag Alfred M. Szmidt
2014-06-20 13:08 ` Eli Zaretskii
2014-06-20 15:52   ` Alfred M. Szmidt
2014-06-20 14:30 ` Stefan Monnier
2014-06-20 15:52   ` Alfred M. Szmidt
2014-06-20 16:24     ` Stefan Monnier
2014-06-20 16:52     ` Josh
2014-06-20 17:35       ` Stefan Monnier
2014-06-20 18:53         ` Ivan Kanis [this message]
2014-06-20 19:07           ` Josh
  -- strict thread matches above, loose matches on Subject: below --
2014-06-20 20:22 Barry OReilly
2014-06-21  1:08 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lhsrtntj.fsf@kanis.fr \
    --to=ivan@kanis.fr \
    --cc=ams@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=josh@foxtail.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).