* elisp programming - navigate through code?
@ 2014-03-29 16:49 Martin
2014-03-29 17:17 ` Thorsten Jolitz
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Martin @ 2014-03-29 16:49 UTC (permalink / raw)
To: GNU Emacs users list
Hi there,
This is now specially for elisp, but maybe its possible for other things to
(ruby on rails - ruby, javascript, coffeescript, ...)
Is there a way to navigate better through my code.
like having a function (foo arg1 arg2) putting the cursor to foo will
C-h f suggest I want to read the docstring for that. Thats good.
But now I'd like to navigate to the definition (which can be in the same
buffer or somewhere else). Is that possbile?
Thanks,
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp programming - navigate through code?
2014-03-29 16:49 elisp programming - navigate through code? Martin
@ 2014-03-29 17:17 ` Thorsten Jolitz
2014-03-29 18:10 ` Michael Heerdegen
2014-03-30 5:23 ` Alex Kost
2 siblings, 0 replies; 6+ messages in thread
From: Thorsten Jolitz @ 2014-03-29 17:17 UTC (permalink / raw)
To: help-gnu-emacs
Martin <kleinerdrache@gmx.at> writes:
> Hi there,
>
> This is now specially for elisp, but maybe its possible for other things to
> (ruby on rails - ruby, javascript, coffeescript, ...)
>
> Is there a way to navigate better through my code.
>
> like having a function (foo arg1 arg2) putting the cursor to foo will
> C-h f suggest I want to read the docstring for that. Thats good.
>
> But now I'd like to navigate to the definition (which can be in the same
> buffer or somewhere else). Is that possbile?
you can use tags
,--------------------------------------------------------------------
| http://www.gnu.org/software/emacs/manual/html_node/eintr/etags.html
`--------------------------------------------------------------------
or a function like this:
,---------------------------------------------------
| ;; jumps to the source of the symbol at point
| (defun tj/goto-symbol-definition ()
| "jump to the source of the symbol at point."
| (interactive)
| (require 'finder)
| (let ((thing (intern (thing-at-point 'symbol))))
| (if (functionp thing)
| (find-function thing)
| (find-variable thing))))
`---------------------------------------------------
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp programming - navigate through code?
2014-03-29 16:49 elisp programming - navigate through code? Martin
2014-03-29 17:17 ` Thorsten Jolitz
@ 2014-03-29 18:10 ` Michael Heerdegen
2014-03-29 21:00 ` Thien-Thi Nguyen
2014-03-30 5:23 ` Alex Kost
2 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2014-03-29 18:10 UTC (permalink / raw)
To: help-gnu-emacs
Hi Martin,
> This is now specially for elisp, but maybe its possible for other
> things to
> (ruby on rails - ruby, javascript, coffeescript, ...)
>
> Is there a way to navigate better through my code.
>
> like having a function (foo arg1 arg2) putting the cursor to foo will
> C-h f suggest I want to read the docstring for that. Thats good.
>
> But now I'd like to navigate to the definition (which can be in the same
> buffer or somewhere else). Is that possbile?
For elisp, you can use something like this:
--8<---------------cut here---------------start------------->8---
(progn
(require 'thingatpt)
(defun my-find-symbol-at-point ()
"Find the definition of the symbol at point."
(interactive)
(let ((sym (symbol-at-point)))
(funcall (pcase sym
((pred facep) #'find-face)
((pred symbol-function) #'find-function)
(_ #'find-variable))
sym)))
(global-set-key [(shift return)] #'my-find-symbol-at-point))
--8<---------------cut here---------------end--------------->8---
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elisp programming - navigate through code?
2014-03-29 16:49 elisp programming - navigate through code? Martin
2014-03-29 17:17 ` Thorsten Jolitz
2014-03-29 18:10 ` Michael Heerdegen
@ 2014-03-30 5:23 ` Alex Kost
2 siblings, 0 replies; 6+ messages in thread
From: Alex Kost @ 2014-03-30 5:23 UTC (permalink / raw)
To: Martin; +Cc: GNU Emacs users list
Martin (2014-03-29 20:49 +0400) wrote:
> Hi there,
>
> This is now specially for elisp, but maybe its possible for other things to
> (ruby on rails - ruby, javascript, coffeescript, ...)
>
> Is there a way to navigate better through my code.
>
> like having a function (foo arg1 arg2) putting the cursor to foo will
> C-h f suggest I want to read the docstring for that. Thats good.
>
> But now I'd like to navigate to the definition (which can be in the same
> buffer or somewhere else). Is that possbile?
You may install "elisp-slime-nav" package
(https://github.com/purcell/elisp-slime-nav). Can be found on MELPA.
It allows to move to the function/variable/face definition immediately.
--
Alex Kost
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-30 5:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-29 16:49 elisp programming - navigate through code? Martin
2014-03-29 17:17 ` Thorsten Jolitz
2014-03-29 18:10 ` Michael Heerdegen
2014-03-29 21:00 ` Thien-Thi Nguyen
2014-03-29 22:31 ` Michael Heerdegen
2014-03-30 5:23 ` Alex Kost
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).