help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: elisp programming - navigate through code?


From: Michael Heerdegen
Subject: Re: elisp programming - navigate through code?
Date: Sat, 29 Mar 2014 19:10:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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.




reply via email to

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