all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to quicker jump to function definition than C-h k ?
@ 2022-12-16  6:19 Jean Louis
  2022-12-16  8:01 ` Marcin Borkowski
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Jean Louis @ 2022-12-16  6:19 UTC (permalink / raw)
  To: Help GNU Emacs

I often wish to jump to function definition of a key and currently I
use `C-h k' flow, then I press `C-x o' to switch to different window
and again `TAB' to reach to the file where function is located, then
`RET' to reach finally to the function definition.

For my personal needs I would like to switch straight to the function
definition of a key.

Maybe such feature already exists, does anybody know how?

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-16  6:19 How to quicker jump to function definition than C-h k ? Jean Louis
@ 2022-12-16  8:01 ` Marcin Borkowski
  2022-12-16  8:13 ` Eduardo Ochs
  2022-12-19 17:44 ` Vagn Johansen
  2 siblings, 0 replies; 16+ messages in thread
From: Marcin Borkowski @ 2022-12-16  8:01 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help GNU Emacs


On 2022-12-16, at 07:19, Jean Louis <bugs@gnu.support> wrote:

> I often wish to jump to function definition of a key and currently I
> use `C-h k' flow, then I press `C-x o' to switch to different window
> and again `TAB' to reach to the file where function is located, then
> `RET' to reach finally to the function definition.
>
> For my personal needs I would like to switch straight to the function
> definition of a key.
>
> Maybe such feature already exists, does anybody know how?

Check out the "helpful" package by Wilfred Hughes.

Hth,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-16  6:19 How to quicker jump to function definition than C-h k ? Jean Louis
  2022-12-16  8:01 ` Marcin Borkowski
@ 2022-12-16  8:13 ` Eduardo Ochs
  2022-12-16 13:39   ` [SOLVED with eev] " Jean Louis
  2022-12-19 17:44 ` Vagn Johansen
  2 siblings, 1 reply; 16+ messages in thread
From: Eduardo Ochs @ 2022-12-16  8:13 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help GNU Emacs

On Fri, 16 Dec 2022 at 03:21, Jean Louis <bugs@gnu.support> wrote:
>
> I often wish to jump to function definition of a key and currently I
> use `C-h k' flow, then I press `C-x o' to switch to different window
> and again `TAB' to reach to the file where function is located, then
> `RET' to reach finally to the function definition.
>
> For my personal needs I would like to switch straight to the function
> definition of a key.
>
> Maybe such feature already exists, does anybody know how?

Hi Jean Louis,
try this:

;; Try: (eek "M-h M-k  <right>")
;;      (eek "M-h M-k  <right>   12*<down>")
;;      (eek "M-h M-k  <right>   12*<down> M-e")
;;      (eek "M-h M-k  M-h M-k  ;; find-ekey-links")
;;      (find-efunction 'find-ekey-links)
;;      (find-efunction 'ee-find-eboundkey-links)
;;      (find-definition-for-key (kbd "<right>"))

(defun find-definition-for-key (key &rest pos-spec-list)
"Based on `find-ekey-links' (`M-h M-k') and `find-efunction'."
  (interactive "kFunction definition for Key: ")
  (find-efunction (key-binding key)))

(defalias 'fdk 'find-definition-for-key)

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [SOLVED with eev] Re: How to quicker jump to function definition than C-h k ?
  2022-12-16  8:13 ` Eduardo Ochs
@ 2022-12-16 13:39   ` Jean Louis
  2022-12-16 20:28     ` Eduardo Ochs
  2022-12-17  0:08     ` Emanuel Berg
  0 siblings, 2 replies; 16+ messages in thread
From: Jean Louis @ 2022-12-16 13:39 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Help GNU Emacs

* Eduardo Ochs <eduardoochs@gmail.com> [2022-12-16 11:14]:
> ;; Try: (eek "M-h M-k  <right>")
> ;;      (eek "M-h M-k  <right>   12*<down>")
> ;;      (eek "M-h M-k  <right>   12*<down> M-e")
> ;;      (eek "M-h M-k  M-h M-k  ;; find-ekey-links")
> ;;      (find-efunction 'find-ekey-links)
> ;;      (find-efunction 'ee-find-eboundkey-links)
> ;;      (find-definition-for-key (kbd "<right>"))
> 
 (defun find-definition-for-key (key &rest pos-spec-list)
 "Based on `find-ekey-links' (`M-h M-k') and `find-efunction'."
   (interactive "kFunction definition for Key: ")
   (find-efunction (key-binding key)))

 (defalias 'fdk 'find-definition-for-key)

Much thanks.

(global-set-key (kbd "C-c k") 'find-definition-for-key)

Now I can jump straight to function definition.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [SOLVED with eev] Re: How to quicker jump to function definition than C-h k ?
  2022-12-16 13:39   ` [SOLVED with eev] " Jean Louis
@ 2022-12-16 20:28     ` Eduardo Ochs
  2022-12-17  0:08     ` Emanuel Berg
  1 sibling, 0 replies; 16+ messages in thread
From: Eduardo Ochs @ 2022-12-16 20:28 UTC (permalink / raw)
  To: Eduardo Ochs, Help GNU Emacs

On Fri, 16 Dec 2022 at 11:45, Jean Louis <bugs@gnu.support> wrote:
>
> * Eduardo Ochs <eduardoochs@gmail.com> [2022-12-16 11:14]:
> > ;; Try: (eek "M-h M-k  <right>")
> > ;;      (eek "M-h M-k  <right>   12*<down>")
> > ;;      (eek "M-h M-k  <right>   12*<down> M-e")
> > ;;      (eek "M-h M-k  M-h M-k  ;; find-ekey-links")
> > ;;      (find-efunction 'find-ekey-links)
> > ;;      (find-efunction 'ee-find-eboundkey-links)
> > ;;      (find-definition-for-key (kbd "<right>"))
> >
>  (defun find-definition-for-key (key &rest pos-spec-list)
>  "Based on `find-ekey-links' (`M-h M-k') and `find-efunction'."
>    (interactive "kFunction definition for Key: ")
>    (find-efunction (key-binding key)))
>
>  (defalias 'fdk 'find-definition-for-key)
>
> Much thanks.
>
> (global-set-key (kbd "C-c k") 'find-definition-for-key)
>
> Now I can jump straight to function definition.

Great! Thanks for the feedback! =)

I try to make the functions and features of eev as composable as
possible - in this sense -

  https://lambdaland.org/posts/2022-11-07_unix_philosophy/

and

  (find-efunction 'right-char)

does _a part_ of what happens when we type `M-h k <right>' and we
click on the link that goes to the source code. I remember vaguely
that I struggled a log in the 90s to discover how to go to the source
without clicking on a button...

  Cheers =),
    Eduardo Ochs
    http://angg.twu.net/#eev
    http://angg.twu.net/eepitch.html



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [SOLVED with eev] Re: How to quicker jump to function definition than C-h k ?
  2022-12-16 13:39   ` [SOLVED with eev] " Jean Louis
  2022-12-16 20:28     ` Eduardo Ochs
@ 2022-12-17  0:08     ` Emanuel Berg
  2022-12-17 12:44       ` Eduardo Ochs
  1 sibling, 1 reply; 16+ messages in thread
From: Emanuel Berg @ 2022-12-17  0:08 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> (defun find-definition-for-key (key &rest pos-spec-list)
> "Based on `find-ekey-links' (`M-h M-k') and `find-efunction'."
>   (interactive "kFunction definition for Key: ")
>   (find-efunction (key-binding key)))

Okay, but where is "find-efunction"?

As always, byte-compile and do

  (checkdoc-current-buffer t)

to hear complains about that, more ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [SOLVED with eev] Re: How to quicker jump to function definition than C-h k ?
  2022-12-17  0:08     ` Emanuel Berg
@ 2022-12-17 12:44       ` Eduardo Ochs
  2022-12-18  6:58         ` Jean Louis
  0 siblings, 1 reply; 16+ messages in thread
From: Eduardo Ochs @ 2022-12-17 12:44 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 17 Dec 2022 at 06:53, Emanuel Berg <incal@dataswamp.org> wrote:
>
> Jean Louis wrote:
>
> > (defun find-definition-for-key (key &rest pos-spec-list)
> > "Based on `find-ekey-links' (`M-h M-k') and `find-efunction'."
> >   (interactive "kFunction definition for Key: ")
> >   (find-efunction (key-binding key)))
>
> Okay, but where is "find-efunction"?
>
> As always, byte-compile and do
>
>   (checkdoc-current-buffer t)
>
> to hear complains about that, more ...

It's in eev, obviously! =)
You can find its source with:

  (find-efunction 'find-efunction)

and it is also here:

  http://angg.twu.net/eev-current/eev-blinks.el.html#find-ebufferandpos

Cheers,
  Eduardo



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [SOLVED with eev] Re: How to quicker jump to function definition than C-h k ?
  2022-12-17 12:44       ` Eduardo Ochs
@ 2022-12-18  6:58         ` Jean Louis
  2022-12-18  7:51           ` Eduardo Ochs
  0 siblings, 1 reply; 16+ messages in thread
From: Jean Louis @ 2022-12-18  6:58 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: help-gnu-emacs

* Eduardo Ochs <eduardoochs@gmail.com> [2022-12-17 15:46]:
> It's in eev, obviously! =)
> You can find its source with:
> 
>   (find-efunction 'find-efunction)

Me I am using eev from time to time, so it works. Though it would be
better to have such function liberated from larger package.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [SOLVED with eev] Re: How to quicker jump to function definition than C-h k ?
  2022-12-18  6:58         ` Jean Louis
@ 2022-12-18  7:51           ` Eduardo Ochs
  0 siblings, 0 replies; 16+ messages in thread
From: Eduardo Ochs @ 2022-12-18  7:51 UTC (permalink / raw)
  To: Eduardo Ochs, help-gnu-emacs

On Sun, 18 Dec 2022 at 04:28, Jean Louis <bugs@gnu.support> wrote:
>
> * Eduardo Ochs <eduardoochs@gmail.com> [2022-12-17 15:46]:
> > It's in eev, obviously! =)
> > You can find its source with:
> >
> >   (find-efunction 'find-efunction)
>
> Me I am using eev from time to time, so it works. Though it would be
> better to have such function liberated from larger package.

Hi Jean Louis,

It should be easy to copy it and its dependencies - they're very few -
to your init files. But note that to run it you only need to have eev
"loaded", not "activated"... this distinction is explained in these
two sections:

  (find-eev-quick-intro   "1. Installing eev" "does NOT activate")
  (find-eev-install-intro "0. Loading eev")

  http://angg.twu.net/eev-intros/find-eev-quick-intro.html#1
  http://angg.twu.net/eev-intros/find-eev-install-intro.html#0

Cheers,
  Eduardo



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-16  6:19 How to quicker jump to function definition than C-h k ? Jean Louis
  2022-12-16  8:01 ` Marcin Borkowski
  2022-12-16  8:13 ` Eduardo Ochs
@ 2022-12-19 17:44 ` Vagn Johansen
  2022-12-19 19:19   ` Marcin Borkowski
                     ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Vagn Johansen @ 2022-12-19 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> For my personal needs I would like to switch straight to the function
> definition of a key.
>
> Maybe such feature already exists, does anybody know how?

Add (find-function-setup-keys) to your config.

Then you can use C-x K for find-function-on-key

-- 
Vagn Johansen




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-19 17:44 ` Vagn Johansen
@ 2022-12-19 19:19   ` Marcin Borkowski
  2022-12-19 21:22     ` Vagn Johansen
  2022-12-19 20:34   ` Emanuel Berg
  2022-12-19 22:33   ` Jean Louis
  2 siblings, 1 reply; 16+ messages in thread
From: Marcin Borkowski @ 2022-12-19 19:19 UTC (permalink / raw)
  To: Vagn Johansen; +Cc: help-gnu-emacs


On 2022-12-19, at 18:44, Vagn Johansen <gonz808@hotmail.com> wrote:

> Jean Louis <bugs@gnu.support> writes:
>
>> For my personal needs I would like to switch straight to the function
>> definition of a key.
>>
>> Maybe such feature already exists, does anybody know how?
>
> Add (find-function-setup-keys) to your config.

Out of curiosity: where does that come from?  My Emacs does not know
such a function...

> Then you can use C-x K for find-function-on-key

...although apparently `find-function-on-key' is a thing.

Best,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-19 17:44 ` Vagn Johansen
  2022-12-19 19:19   ` Marcin Borkowski
@ 2022-12-19 20:34   ` Emanuel Berg
  2022-12-19 22:33   ` Jean Louis
  2 siblings, 0 replies; 16+ messages in thread
From: Emanuel Berg @ 2022-12-19 20:34 UTC (permalink / raw)
  To: help-gnu-emacs

Vagn Johansen wrote:

> Add (find-function-setup-keys) to your config.
>
> Then you can use C-x K for find-function-on-key

Indeed, that works, I have my own implementation for that
- based on shell tools, and it only works for my own Elisp -
so this is not only built-in, it's better as well!

Thank you, no idea that existed!

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-19 19:19   ` Marcin Borkowski
@ 2022-12-19 21:22     ` Vagn Johansen
  2022-12-19 22:15       ` Emanuel Berg
  2022-12-20  6:02       ` Marcin Borkowski
  0 siblings, 2 replies; 16+ messages in thread
From: Vagn Johansen @ 2022-12-19 21:22 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2022-12-19, at 18:44, Vagn Johansen <gonz808@hotmail.com> wrote:
>
>> Jean Louis <bugs@gnu.support> writes:
>>
>>> For my personal needs I would like to switch straight to the function
>>> definition of a key.
>>>
>>> Maybe such feature already exists, does anybody know how?
>>
>> Add (find-function-setup-keys) to your config.
>
> Out of curiosity: where does that come from?  My Emacs does not know
> such a function...

Try using C-x F :)


It has been a part of Emacs since 1997

https://github.com/typester/emacs/blob/master/lisp/emacs-lisp/find-func.el


-- 
Vagn Johansen




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-19 21:22     ` Vagn Johansen
@ 2022-12-19 22:15       ` Emanuel Berg
  2022-12-20  6:02       ` Marcin Borkowski
  1 sibling, 0 replies; 16+ messages in thread
From: Emanuel Berg @ 2022-12-19 22:15 UTC (permalink / raw)
  To: help-gnu-emacs

Vagn Johansen wrote:

>> Out of curiosity: where does that come from? My Emacs does
>> not know such a function...
>
> Try using C-x F :)
>
> It has been a part of Emacs since 1997

100% correct, I also had no idea ...

Got to rewire my own shortcut and dewire my own hack for
this ...

Mr. Johansen is no doubt the man of the day!

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-19 17:44 ` Vagn Johansen
  2022-12-19 19:19   ` Marcin Borkowski
  2022-12-19 20:34   ` Emanuel Berg
@ 2022-12-19 22:33   ` Jean Louis
  2 siblings, 0 replies; 16+ messages in thread
From: Jean Louis @ 2022-12-19 22:33 UTC (permalink / raw)
  To: Vagn Johansen; +Cc: help-gnu-emacs

* Vagn Johansen <gonz808@hotmail.com> [2022-12-19 20:46]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > For my personal needs I would like to switch straight to the function
> > definition of a key.
> >
> > Maybe such feature already exists, does anybody know how?
> 
> Add (find-function-setup-keys) to your config.
> 
> Then you can use C-x K for find-function-on-key

Very simple. Thanks. That is why I think when I think something or
need in Emacs probability is that it already exists.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to quicker jump to function definition than C-h k ?
  2022-12-19 21:22     ` Vagn Johansen
  2022-12-19 22:15       ` Emanuel Berg
@ 2022-12-20  6:02       ` Marcin Borkowski
  1 sibling, 0 replies; 16+ messages in thread
From: Marcin Borkowski @ 2022-12-20  6:02 UTC (permalink / raw)
  To: Vagn Johansen; +Cc: help-gnu-emacs


On 2022-12-19, at 22:22, Vagn Johansen <gonz808@hotmail.com> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> On 2022-12-19, at 18:44, Vagn Johansen <gonz808@hotmail.com> wrote:
>>
>>> Jean Louis <bugs@gnu.support> writes:
>>>
>>>> For my personal needs I would like to switch straight to the function
>>>> definition of a key.
>>>>
>>>> Maybe such feature already exists, does anybody know how?
>>>
>>> Add (find-function-setup-keys) to your config.
>>
>> Out of curiosity: where does that come from?  My Emacs does not know
>> such a function...
>
> Try using C-x F :)

Now that's interesting:

--8<---------------cut here---------------start------------->8---
C-x f (translated from C-x F) runs the command set-fill-column
--8<---------------cut here---------------end--------------->8---

> It has been a part of Emacs since 1997
>
> https://github.com/typester/emacs/blob/master/lisp/emacs-lisp/find-func.el

Yes, I can see it now, though it's not loaded by default (that's why my
Emacs didn't have this function defined).

Thanks,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-12-20  6:02 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-16  6:19 How to quicker jump to function definition than C-h k ? Jean Louis
2022-12-16  8:01 ` Marcin Borkowski
2022-12-16  8:13 ` Eduardo Ochs
2022-12-16 13:39   ` [SOLVED with eev] " Jean Louis
2022-12-16 20:28     ` Eduardo Ochs
2022-12-17  0:08     ` Emanuel Berg
2022-12-17 12:44       ` Eduardo Ochs
2022-12-18  6:58         ` Jean Louis
2022-12-18  7:51           ` Eduardo Ochs
2022-12-19 17:44 ` Vagn Johansen
2022-12-19 19:19   ` Marcin Borkowski
2022-12-19 21:22     ` Vagn Johansen
2022-12-19 22:15       ` Emanuel Berg
2022-12-20  6:02       ` Marcin Borkowski
2022-12-19 20:34   ` Emanuel Berg
2022-12-19 22:33   ` Jean Louis

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.