* Eclipse-style control-click on Elisp function name to visit source
@ 2011-05-06 15:11 Ted Zlatanov
2011-05-06 17:20 ` Alan Mackenzie
2011-05-06 17:28 ` Stefan Monnier
0 siblings, 2 replies; 5+ messages in thread
From: Ted Zlatanov @ 2011-05-06 15:11 UTC (permalink / raw
To: help-gnu-emacs
Right now, if I want to see the definition of a function, I do `C-h f'
to see the docstring, then RET on the link to the definition.
I'd like to bind that visit directly to `C-mouse-1' click on any
function name in any ELisp buffer, similar to how Eclipse does it for
Java code for instance. I couldn't find a way to do it in Emacs. Any
ideas? Or should I write it myself?
Thanks
Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eclipse-style control-click on Elisp function name to visit source
2011-05-06 15:11 Eclipse-style control-click on Elisp function name to visit source Ted Zlatanov
@ 2011-05-06 17:20 ` Alan Mackenzie
2011-05-06 20:41 ` Ted Zlatanov
2011-05-06 17:28 ` Stefan Monnier
1 sibling, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2011-05-06 17:20 UTC (permalink / raw
To: help-gnu-emacs
Ted Zlatanov <tzz@lifelogs.com> wrote:
> Right now, if I want to see the definition of a function, I do `C-h f'
> to see the docstring, then RET on the link to the definition.
> I'd like to bind that visit directly to `C-mouse-1' click on any
> function name in any ELisp buffer, similar to how Eclipse does it for
> Java code for instance. I couldn't find a way to do it in Emacs. Any
> ideas? Or should I write it myself?
I think you should write it yourself. Shouldn't be too difficult. The
difficult bit is chosing a key binding (or a "mouse binding").
> Thanks
> Ted
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eclipse-style control-click on Elisp function name to visit source
2011-05-06 17:20 ` Alan Mackenzie
@ 2011-05-06 20:41 ` Ted Zlatanov
0 siblings, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2011-05-06 20:41 UTC (permalink / raw
To: help-gnu-emacs
On Fri, 6 May 2011 17:20:28 +0000 (UTC) Alan Mackenzie <acm@muc.de> wrote:
AM> Ted Zlatanov <tzz@lifelogs.com> wrote:
>> Right now, if I want to see the definition of a function, I do `C-h f'
>> to see the docstring, then RET on the link to the definition.
>> I'd like to bind that visit directly to `C-mouse-1' click on any
>> function name in any ELisp buffer, similar to how Eclipse does it for
>> Java code for instance. I couldn't find a way to do it in Emacs. Any
>> ideas? Or should I write it myself?
AM> I think you should write it yourself. Shouldn't be too difficult. The
AM> difficult bit is chosing a key binding (or a "mouse binding").
On Fri, 06 May 2011 14:28:51 -0300 Stefan Monnier <monnier@iro.umontreal.ca> wrote:
SM> M-x find-function is pretty close.
The code below seems to do the job (I don't use the regular C-Mouse-1
binding that selects among the buffers).
I'd like to highlight valid symbols *only* (which would respond to one
of the handled conditions in `tzz-find-symbol-at-point') when the mouse
hovers over them but haven't done it. Otherwise this seems like a nice
feature for people who are used to the Eclipse style of finding
functions and variables, and could even be enabled by default in Emacs
or made into a package. I'm happy with it as it is, but if you find it
useful let me know and I'll make it fit for general consumption.
Thanks
Ted
#+begin_src lisp
(defun tzz-find-symbol-at-point ()
"Find the function, face, or variable definition for the symbol at point
in the other window."
(interactive)
(let ((symb (symbol-at-point)))
(cond
((and (or (functionp symb)
(fboundp symb))
(find-definition-noselect symb nil))
(find-function-other-window symb))
((and (facep symb) (find-definition-noselect symb 'defface))
(find-face-definition symb))
((and (boundp symb) (find-definition-noselect symb 'defvar))
(find-variable-other-window symb))
(t (message "No symbol at point")))))
(global-set-key [(control mouse-1)]
(lambda (click)
(interactive "e")
(mouse-minibuffer-check click)
(let* ((window (posn-window (event-start click)))
(buf (window-buffer window)))
(with-current-buffer buf
(save-excursion
(goto-char (posn-point (event-start click)))
(tzz-find-symbol-at-point))))))
#+end_src
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eclipse-style control-click on Elisp function name to visit source
2011-05-06 15:11 Eclipse-style control-click on Elisp function name to visit source Ted Zlatanov
2011-05-06 17:20 ` Alan Mackenzie
@ 2011-05-06 17:28 ` Stefan Monnier
2011-05-07 17:56 ` Vagn Johansen
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2011-05-06 17:28 UTC (permalink / raw
To: help-gnu-emacs
> I'd like to bind that visit directly to `C-mouse-1' click on any
> function name in any ELisp buffer, similar to how Eclipse does it for
> Java code for instance. I couldn't find a way to do it in Emacs. Any
> ideas? Or should I write it myself?
M-x find-function is pretty close.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eclipse-style control-click on Elisp function name to visit source
2011-05-06 17:28 ` Stefan Monnier
@ 2011-05-07 17:56 ` Vagn Johansen
0 siblings, 0 replies; 5+ messages in thread
From: Vagn Johansen @ 2011-05-07 17:56 UTC (permalink / raw
To: help-gnu-emacs
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I'd like to bind that visit directly to `C-mouse-1' click on any
>> function name in any ELisp buffer, similar to how Eclipse does it for
>> Java code for instance. I couldn't find a way to do it in Emacs. Any
>> ideas? Or should I write it myself?
>
> M-x find-function is pretty close.
>
Call (find-function-setup-keys) and find-function is then bound C-h F
--
Vagn Johansen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-07 17:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06 15:11 Eclipse-style control-click on Elisp function name to visit source Ted Zlatanov
2011-05-06 17:20 ` Alan Mackenzie
2011-05-06 20:41 ` Ted Zlatanov
2011-05-06 17:28 ` Stefan Monnier
2011-05-07 17:56 ` Vagn Johansen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.