emacs-devel
[Top][All Lists]
Advanced

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

Re: Proposal: add a binding for `imenu' under M-g


From: Kévin Le Gouguec
Subject: Re: Proposal: add a binding for `imenu' under M-g
Date: Wed, 20 Apr 2022 22:54:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Date: Wed, 20 Apr 2022 11:02:55 +0300
>> Cc: yandros@gmail.com, emacs-devel@gnu.org,
>>  Sean Whitton <spwhitton@spwhitton.name>
>> 
>> M-s feels good as mnemonic for search/show, and indeed, we have "M-s o"
>> (occur - searches and shows), "M-s h" (highlight - also searches and
>> shows) and maybe others.  Yes you can go to occur results, but that's
>> another action.
>> 
>> While M-g would mean "go".  And stuff like "M-g g", "M-g c", they
>> request input only to go somewhere.  imenu falls in this category -
>> request input (select from completions) and go there.
>
> To me, imenu is a facility to find definitions of functions, so it is
> conceptually very similar to M-. and other such features.  We don't
> perceive M-. as a "go" command, do we?
>
> M-s is not just for searching.  It has, for example, a set of bindings
> that invoke hi-lock commands, which are not about searching at all.
> We could have a similar "M-s i" prefix for imenu commands.

Personally,

* when I reach for M-s commands (isearch-forward-*, occur,
  highlight-*/hi-lock-*), I feel like I am looking for a command that
  operates on a set of _matches_ (jumping successively through the set,
  collecting & displaying the set, highlighting the set),

* when I reach for M-g commands, I feel like I want to jump to "precise"
  locations, i.e. locations that are not defined by pattern matching,
  but by some other semantics (e.g. line numbers, error reports).

So M-. could very well bound to M-g d and/or M-g M-d, and it wouldn't
break my (perhaps twisted) grokking of the M-g prefix: I use it to visit
the "canonical" location for a symbol, defined by TAGS files, LSP
servers…  though it's true that M-. sometimes does "match" more than one
locations.

Consequently, having imenu on the M-g prefix sounds more natural to me.

This probably paraphrases what others have said to some extent; sorry if
it doesn't bring much to the table.  I realize that the distinction I
make between M-g and M-s is personal and won't begrudge anyone for
having different notions about these prefixes.



reply via email to

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