unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Proposal: add a binding for `imenu' under M-g
@ 2022-04-08 15:36 Sean Whitton
  2022-04-14 14:16 ` Sean Whitton
  0 siblings, 1 reply; 36+ messages in thread
From: Sean Whitton @ 2022-04-08 15:36 UTC (permalink / raw)
  To: emacs-devel

Hello,

`imenu' doesn't have a binding.  How about binding it to 'M-g i'?

Please excuse me if this has been discussed and rejected before.

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-08 15:36 Proposal: add a binding for `imenu' under M-g Sean Whitton
@ 2022-04-14 14:16 ` Sean Whitton
  2022-04-14 16:14   ` Eli Zaretskii
  2022-04-14 16:24   ` Filipp Gunbin
  0 siblings, 2 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-14 14:16 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

Hello,

On Fri 08 Apr 2022 at 08:36am -07, Sean Whitton wrote:

> `imenu' doesn't have a binding.  How about binding it to 'M-g i'?

Here is a patch.  I'll wait at least another week before installing it.

-- 
Sean Whitton

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Bind-imenu-to-M-g-i-globally.patch --]
[-- Type: text/x-diff, Size: 2557 bytes --]

From a1efc55529cbc35d82e37984ada880e16ca94ecd Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Thu, 14 Apr 2022 07:12:41 -0700
Subject: [PATCH] Bind 'imenu' to 'M-g i' globally.

* lisp/bindings.el (goto-map): Bind 'imenu' to 'M-g i' globally.
* doc/emacs/programs.texi (Imenu):
* lisp/progmodes/cperl-mode.el: Replace 'M-x imenu' with 'M-g i'.
* etc/NEWS: Document the change.
---
 doc/emacs/programs.texi      | 4 ++--
 etc/NEWS                     | 3 +++
 lisp/bindings.el             | 1 +
 lisp/progmodes/cperl-mode.el | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index ff4405f1fb..45bc4c79b4 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -250,8 +250,8 @@ Imenu
 together.)
 
 @findex imenu
-  If you type @kbd{M-x imenu}, it reads the name of a definition using
-the minibuffer, then moves point to that definition.  You can use
+  If you type @kbd{M-g i}, it reads the name of a definition using the
+minibuffer, then moves point to that definition.  You can use
 completion to specify the name; the command always displays the whole
 list of valid names.
 
diff --git a/etc/NEWS b/etc/NEWS
index 79c27da549..152fc40c46 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -499,6 +499,9 @@ are met.  The conditions are given by the argument, which can be
 +++
 *** New command 'rcirc-when'.
 
++++
+** 'imenu' is now bound to 'M-g i' globally.
+
 * Editing Changes in Emacs 29.1
 
 ---
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 1913f82600..bfe5ba8623 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1127,6 +1127,7 @@ goto-map
 (define-key goto-map    "p" 'previous-error)
 (define-key goto-map "\M-p" 'previous-error)
 (define-key goto-map   "\t" 'move-to-column)
+(define-key goto-map    "i" 'imenu)
 
 (defvar search-map (make-sparse-keymap)
   "Keymap for search related commands.")
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 94ecc45b15..3742286e5d 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -64,7 +64,7 @@
 ;; This mode supports font-lock, imenu and mode-compile.  In the
 ;; hairy version font-lock is on, but you should activate imenu
 ;; yourself (note that mode-compile is not standard yet).  Well, you
-;; can use imenu from keyboard anyway (M-x imenu), but it is better
+;; can use imenu from keyboard anyway (M-g i), but it is better
 ;; to bind it like that:
 
 ;; (define-key global-map [M-S-down-mouse-3] 'imenu)
-- 
2.30.2


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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 14:16 ` Sean Whitton
@ 2022-04-14 16:14   ` Eli Zaretskii
  2022-04-14 17:21     ` Filipp Gunbin
  2022-04-14 16:24   ` Filipp Gunbin
  1 sibling, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2022-04-14 16:14 UTC (permalink / raw)
  To: Sean Whitton; +Cc: emacs-devel

> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Thu, 14 Apr 2022 07:16:02 -0700
> 
> > `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
> 
> Here is a patch.  I'll wait at least another week before installing it.

I wonder why M-g.  That prefix is for commands the "go" somewhere, and
this one doesn't.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 14:16 ` Sean Whitton
  2022-04-14 16:14   ` Eli Zaretskii
@ 2022-04-14 16:24   ` Filipp Gunbin
  1 sibling, 0 replies; 36+ messages in thread
From: Filipp Gunbin @ 2022-04-14 16:24 UTC (permalink / raw)
  To: Sean Whitton; +Cc: emacs-devel

On 14/04/2022 07:16 -0700, Sean Whitton wrote:

> Hello,
>
> On Fri 08 Apr 2022 at 08:36am -07, Sean Whitton wrote:
>
>> `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
>
> Here is a patch.  I'll wait at least another week before installing it.
>

+1 for this, I use imenu *very* frequently.  But maybe others will
object.

Filipp



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 16:14   ` Eli Zaretskii
@ 2022-04-14 17:21     ` Filipp Gunbin
  2022-04-14 18:00       ` Sean Whitton
  2022-04-14 18:12       ` Eli Zaretskii
  0 siblings, 2 replies; 36+ messages in thread
From: Filipp Gunbin @ 2022-04-14 17:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, Sean Whitton

On 14/04/2022 19:14 +0300, Eli Zaretskii wrote:

>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Date: Thu, 14 Apr 2022 07:16:02 -0700
>> 
>> > `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
>> 
>> Here is a patch.  I'll wait at least another week before installing it.
>
> I wonder why M-g.  That prefix is for commands the "go" somewhere, and
> this one doesn't.

But the purpose of imenu is "go to the index entry", it just offers
completion before that.

Filipp



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 17:21     ` Filipp Gunbin
@ 2022-04-14 18:00       ` Sean Whitton
  2022-04-14 18:12       ` Eli Zaretskii
  1 sibling, 0 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-14 18:00 UTC (permalink / raw)
  To: Filipp Gunbin, Eli Zaretskii; +Cc: emacs-devel

Hello,

On Thu 14 Apr 2022 at 08:21pm +03, Filipp Gunbin wrote:

> On 14/04/2022 19:14 +0300, Eli Zaretskii wrote:
>
>>> From: Sean Whitton <spwhitton@spwhitton.name>
>>> Date: Thu, 14 Apr 2022 07:16:02 -0700
>>>
>>> > `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
>>>
>>> Here is a patch.  I'll wait at least another week before installing it.
>>
>> I wonder why M-g.  That prefix is for commands the "go" somewhere, and
>> this one doesn't.
>
> But the purpose of imenu is "go to the index entry", it just offers
> completion before that.

This is what I had in mind, indeed.

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 17:21     ` Filipp Gunbin
  2022-04-14 18:00       ` Sean Whitton
@ 2022-04-14 18:12       ` Eli Zaretskii
  2022-04-14 19:03         ` chad
                           ` (2 more replies)
  1 sibling, 3 replies; 36+ messages in thread
From: Eli Zaretskii @ 2022-04-14 18:12 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: emacs-devel, spwhitton

> From: Filipp Gunbin <fgunbin@fastmail.fm>
> Cc: Sean Whitton <spwhitton@spwhitton.name>,  emacs-devel@gnu.org
> Date: Thu, 14 Apr 2022 20:21:21 +0300
> 
> On 14/04/2022 19:14 +0300, Eli Zaretskii wrote:
> 
> >> From: Sean Whitton <spwhitton@spwhitton.name>
> >> Date: Thu, 14 Apr 2022 07:16:02 -0700
> >> 
> >> > `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
> >> 
> >> Here is a patch.  I'll wait at least another week before installing it.
> >
> > I wonder why M-g.  That prefix is for commands the "go" somewhere, and
> > this one doesn't.
> 
> But the purpose of imenu is "go to the index entry", it just offers
> completion before that.

We have a lot of commands that display a menu of possibilities, and
I'm not sure it is valid to consider them all as "go to somewhere".



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 18:12       ` Eli Zaretskii
@ 2022-04-14 19:03         ` chad
  2022-04-15  5:51           ` Eli Zaretskii
  2022-04-14 19:37         ` Sean Whitton
  2022-04-14 19:47         ` [External] : " Drew Adams
  2 siblings, 1 reply; 36+ messages in thread
From: chad @ 2022-04-14 19:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Sean Whitton, Filipp Gunbin, EMACS development team

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

From the imenu info node:

> If you type ‘M-x imenu’, it reads the name of a definition using the
> minibuffer, then moves point to that definition.[...]


From the goto-line/goto-char info entries (in Moving Point):

> ‘M-g g’
>      Read a number N and move point to the beginning of line number N
>      (‘goto-line’).[...]

‘M-g c’
>      Read a number N and move point to buffer position N. [...]


The parallel seems pretty clear to me. I tried it out in Org and a couple
elisp files, and it felt natural. What am I missing? (Honest question; I
haven't used imenu much in practice.)

~Chad

[-- Attachment #2: Type: text/html, Size: 1408 bytes --]

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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 18:12       ` Eli Zaretskii
  2022-04-14 19:03         ` chad
@ 2022-04-14 19:37         ` Sean Whitton
  2022-04-14 19:52           ` [External] : " Drew Adams
  2022-04-19 14:21           ` Stephen Leake
  2022-04-14 19:47         ` [External] : " Drew Adams
  2 siblings, 2 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-14 19:37 UTC (permalink / raw)
  To: Eli Zaretskii, Filipp Gunbin; +Cc: emacs-devel

Hello,

On Thu 14 Apr 2022 at 09:12PM +03, Eli Zaretskii wrote:

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Cc: Sean Whitton <spwhitton@spwhitton.name>,  emacs-devel@gnu.org
>> Date: Thu, 14 Apr 2022 20:21:21 +0300
>>
>> On 14/04/2022 19:14 +0300, Eli Zaretskii wrote:
>>
>> >> From: Sean Whitton <spwhitton@spwhitton.name>
>> >> Date: Thu, 14 Apr 2022 07:16:02 -0700
>> >>
>> >> > `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
>> >>
>> >> Here is a patch.  I'll wait at least another week before installing it.
>> >
>> > I wonder why M-g.  That prefix is for commands the "go" somewhere, and
>> > this one doesn't.
>>
>> But the purpose of imenu is "go to the index entry", it just offers
>> completion before that.
>
> We have a lot of commands that display a menu of possibilities, and
> I'm not sure it is valid to consider them all as "go to somewhere".

As Chad mentioned, it seems particularly salient to me that just like
M-g g and M-g c, imenu is about getting to somewhere else in the buffer
given a small amount of user input.

-- 
Sean Whitton



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

* RE: [External] : Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 18:12       ` Eli Zaretskii
  2022-04-14 19:03         ` chad
  2022-04-14 19:37         ` Sean Whitton
@ 2022-04-14 19:47         ` Drew Adams
  2 siblings, 0 replies; 36+ messages in thread
From: Drew Adams @ 2022-04-14 19:47 UTC (permalink / raw)
  To: Eli Zaretskii, Filipp Gunbin
  Cc: spwhitton@spwhitton.name, emacs-devel@gnu.org

> > >> From: Sean Whitton <spwhitton@spwhitton.name>
> > >> Date: Thu, 14 Apr 2022 07:16:02 -0700
> > >>
> > >> > `imenu' doesn't have a binding.  How about binding it to 'M-g i'?
> > >
> > > I wonder why M-g.  That prefix is for commands the "go" somewhere,
> > > and this one doesn't.
> >
> > But the purpose of imenu is "go to the index entry", it just offers
> > completion before that.
> 
> We have a lot of commands that display a menu of possibilities, and
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> I'm not sure it is valid to consider them all as "go to somewhere".
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^

Did someone say that all commands that display a menu
should be considered as providing menu items that go
somewhere?

(FWIW, I don't really care whether we add an `imenu'
key binding on `M-g'.  I'm just pointing to the jump
in logic of that statement.  It went "somewhere"...)

Imenu menu items do generally "go somewhere", IMO.

Similarly, most bookmark "jump" commands generally
"go somewhere".  So do commands such as `find-file',
`pop-to-buffer', and `other-window'.

Whether this or that command (accessed from a menu
or not) deserves access from prefix key `M-g' is a
question to be answered case by case.  Command
`imenu' is a reasonable contender, I think.

Maybe that's what you really meant?  Lots of commands
go somewhere.  That general characterization likely
can't be the sole argument to give a command a binding
on `M-g'.  Otherwise we'd have a pretty large set of
`M-g' bindings.

If that's your point then I agree with it.  Maybe
any "go somewhere" command could be considered for
`M-g' candidacy.  But I don't think consideration of
such candidacy applies to all commands that show a
menu.  Going somewhere is relevant here.  Showing a
menu, in itself, is not.






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

* RE: [External] : Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 19:37         ` Sean Whitton
@ 2022-04-14 19:52           ` Drew Adams
  2022-04-19 14:21           ` Stephen Leake
  1 sibling, 0 replies; 36+ messages in thread
From: Drew Adams @ 2022-04-14 19:52 UTC (permalink / raw)
  To: Sean Whitton, Eli Zaretskii, Filipp Gunbin; +Cc: emacs-devel@gnu.org

> As Chad mentioned, it seems particularly salient to me that just like
> M-g g and M-g c, imenu is about getting to somewhere else in the buffer
> given a small amount of user input.

Is the criterion going somewhere "in the buffer" or
just going somewhere?  I'll point out that there are
four `M-g' bindings given to `next|previous-error',
and those commands are not limited to destinations
in the same buffer.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 19:03         ` chad
@ 2022-04-15  5:51           ` Eli Zaretskii
  2022-04-15  6:45             ` Sean Whitton
  0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2022-04-15  5:51 UTC (permalink / raw)
  To: chad; +Cc: emacs-devel, fgunbin, spwhitton

> From: chad <yandros@gmail.com>
> Date: Thu, 14 Apr 2022 15:03:54 -0400
> Cc: Sean Whitton <spwhitton@spwhitton.name>,
>  Filipp Gunbin <fgunbin@fastmail.fm>,
>  EMACS development team <emacs-devel@gnu.org>
> 
> From the imenu info node:
> 
>  If you type ‘M-x imenu’, it reads the name of a definition using the
>  minibuffer, then moves point to that definition.[...]

How is this different from what M-. does? or "C-x `"? or even
"C-x b", for that matter?

> The parallel seems pretty clear to me. I tried it out in Org and a couple elisp files, and it felt natural. What am
> I missing? (Honest question; I haven't used imenu much in practice.)

Many Emacs commands eventually "go" someplace.  That doesn't yet mean
they should all have a binding with the M-g prefix.  I'm saying that
we should perhaps give imenu a different key binding.  Why is that
idea being rejected without seriously considering it?



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-15  5:51           ` Eli Zaretskii
@ 2022-04-15  6:45             ` Sean Whitton
  2022-04-15  6:50               ` Eli Zaretskii
  0 siblings, 1 reply; 36+ messages in thread
From: Sean Whitton @ 2022-04-15  6:45 UTC (permalink / raw)
  To: Eli Zaretskii, chad; +Cc: fgunbin, emacs-devel

Hello,

On Fri 15 Apr 2022 at 08:51am +03, Eli Zaretskii wrote:

> Many Emacs commands eventually "go" someplace.  That doesn't yet mean
> they should all have a binding with the M-g prefix.  I'm saying that
> we should perhaps give imenu a different key binding.  Why is that
> idea being rejected without seriously considering it?

I don't mean to reject it without consideration.

Another one I thought of today was 'M-s i' because there is some
similarity with 'M-s o' and 'M-s M-w'.  How does that seem?

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-15  6:45             ` Sean Whitton
@ 2022-04-15  6:50               ` Eli Zaretskii
  2022-04-15 17:16                 ` Howard Melman
                                   ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Eli Zaretskii @ 2022-04-15  6:50 UTC (permalink / raw)
  To: Sean Whitton; +Cc: yandros, fgunbin, emacs-devel

> From: Sean Whitton <spwhitton@spwhitton.name>
> Cc: fgunbin@fastmail.fm, emacs-devel@gnu.org
> Date: Thu, 14 Apr 2022 23:45:29 -0700
> 
> Another one I thought of today was 'M-s i' because there is some
> similarity with 'M-s o' and 'M-s M-w'.  How does that seem?

Sounds better to me, thanks.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-15  6:50               ` Eli Zaretskii
@ 2022-04-15 17:16                 ` Howard Melman
  2022-04-15 17:16                 ` Howard Melman
  2022-04-20  5:15                 ` Sean Whitton
  2 siblings, 0 replies; 36+ messages in thread
From: Howard Melman @ 2022-04-15 17:16 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Cc: fgunbin@fastmail.fm, emacs-devel@gnu.org
>> Date: Thu, 14 Apr 2022 23:45:29 -0700
>>
>> Another one I thought of today was 'M-s i' because there is some
>> similarity with 'M-s o' and 'M-s M-w'.  How does that seem?
>
> Sounds better to me, thanks.

FWIW imenu makes more sense to me on M-g i than M-s i.  I
think of it as more similar to next-error (on M-g n) where
there's an existing generated list and I want to go to one
of the items on it (the next one or one I specify).

I'm not searching for something (that might not be there),
I'm just picking from a list of existing things like any
other completing-read call.


-- 

Howard




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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-15  6:50               ` Eli Zaretskii
  2022-04-15 17:16                 ` Howard Melman
@ 2022-04-15 17:16                 ` Howard Melman
  2022-04-20  5:15                 ` Sean Whitton
  2 siblings, 0 replies; 36+ messages in thread
From: Howard Melman @ 2022-04-15 17:16 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Cc: fgunbin@fastmail.fm, emacs-devel@gnu.org
>> Date: Thu, 14 Apr 2022 23:45:29 -0700
>>
>> Another one I thought of today was 'M-s i' because there is some
>> similarity with 'M-s o' and 'M-s M-w'.  How does that seem?
>
> Sounds better to me, thanks.

FWIW imenu makes more sense to me on M-g i than M-s i.  I
think of it as more similar to next-error (on M-g n) where
there's an existing generated list and I want to go to one
of the items on it (the next one or one I specify).

I'm not searching for something (that might not be there),
I'm just picking from a list of existing things like any
other completing-read call.


-- 

Howard




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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-14 19:37         ` Sean Whitton
  2022-04-14 19:52           ` [External] : " Drew Adams
@ 2022-04-19 14:21           ` Stephen Leake
  1 sibling, 0 replies; 36+ messages in thread
From: Stephen Leake @ 2022-04-19 14:21 UTC (permalink / raw)
  To: Sean Whitton; +Cc: Eli Zaretskii, Filipp Gunbin, emacs-devel

Sean Whitton <spwhitton@spwhitton.name> writes:

> As Chad mentioned, it seems particularly salient to me that just like
> M-g g and M-g c, imenu is about getting to somewhere else in the buffer
> given a small amount of user input.

+1

-- 
-- Stephe



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-15  6:50               ` Eli Zaretskii
  2022-04-15 17:16                 ` Howard Melman
  2022-04-15 17:16                 ` Howard Melman
@ 2022-04-20  5:15                 ` Sean Whitton
  2022-04-20  6:38                   ` Eli Zaretskii
  2 siblings, 1 reply; 36+ messages in thread
From: Sean Whitton @ 2022-04-20  5:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: yandros, fgunbin, emacs-devel

Hello,

On Fri 15 Apr 2022 at 09:50am +03, Eli Zaretskii wrote:

>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Cc: fgunbin@fastmail.fm, emacs-devel@gnu.org
>> Date: Thu, 14 Apr 2022 23:45:29 -0700
>>
>> Another one I thought of today was 'M-s i' because there is some
>> similarity with 'M-s o' and 'M-s M-w'.  How does that seem?
>
> Sounds better to me, thanks.

Would you mind saying how strongly you think M-s i is better than M-g i?

I ask because while I myself have become neutral between the two,
everyone else who has spoken up seems to prefer M-g i.  So I was hoping
you might say more.  Thanks.

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  5:15                 ` Sean Whitton
@ 2022-04-20  6:38                   ` Eli Zaretskii
  2022-04-20  8:02                     ` Filipp Gunbin
  2022-04-21 19:01                     ` Sean Whitton
  0 siblings, 2 replies; 36+ messages in thread
From: Eli Zaretskii @ 2022-04-20  6:38 UTC (permalink / raw)
  To: Sean Whitton; +Cc: yandros, fgunbin, emacs-devel

> From: Sean Whitton <spwhitton@spwhitton.name>
> Cc: yandros@gmail.com, fgunbin@fastmail.fm, emacs-devel@gnu.org
> Date: Tue, 19 Apr 2022 22:15:47 -0700
> 
> Hello,
> 
> On Fri 15 Apr 2022 at 09:50am +03, Eli Zaretskii wrote:
> 
> >> From: Sean Whitton <spwhitton@spwhitton.name>
> >> Cc: fgunbin@fastmail.fm, emacs-devel@gnu.org
> >> Date: Thu, 14 Apr 2022 23:45:29 -0700
> >>
> >> Another one I thought of today was 'M-s i' because there is some
> >> similarity with 'M-s o' and 'M-s M-w'.  How does that seem?
> >
> > Sounds better to me, thanks.
> 
> Would you mind saying how strongly you think M-s i is better than M-g i?
> 
> I ask because while I myself have become neutral between the two,
> everyone else who has spoken up seems to prefer M-g i.  So I was hoping
> you might say more.  Thanks.

I don't know in what units to measure that and how, sorry.  It's just
an intuitive feeling of having my proverbial brow raise when I saw the
suggestion, that's all.  I think it's up to you to decide how much it
weighs.

The others didn't explain their motivation, either.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  6:38                   ` Eli Zaretskii
@ 2022-04-20  8:02                     ` Filipp Gunbin
  2022-04-20  8:15                       ` Eli Zaretskii
  2022-04-21 19:01                     ` Sean Whitton
  1 sibling, 1 reply; 36+ messages in thread
From: Filipp Gunbin @ 2022-04-20  8:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: yandros, emacs-devel, Sean Whitton

On 20/04/2022 09:38 +0300, Eli Zaretskii wrote:

>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Cc: yandros@gmail.com, fgunbin@fastmail.fm, emacs-devel@gnu.org
>> Date: Tue, 19 Apr 2022 22:15:47 -0700
>> 
>> Hello,
>> 
>> On Fri 15 Apr 2022 at 09:50am +03, Eli Zaretskii wrote:
>> 
>> >> From: Sean Whitton <spwhitton@spwhitton.name>
>> >> Cc: fgunbin@fastmail.fm, emacs-devel@gnu.org
>> >> Date: Thu, 14 Apr 2022 23:45:29 -0700
>> >>
>> >> Another one I thought of today was 'M-s i' because there is some
>> >> similarity with 'M-s o' and 'M-s M-w'.  How does that seem?
>> >
>> > Sounds better to me, thanks.
>> 
>> Would you mind saying how strongly you think M-s i is better than M-g i?
>> 
>> I ask because while I myself have become neutral between the two,
>> everyone else who has spoken up seems to prefer M-g i.  So I was hoping
>> you might say more.  Thanks.
>
> I don't know in what units to measure that and how, sorry.  It's just
> an intuitive feeling of having my proverbial brow raise when I saw the
> suggestion, that's all.  I think it's up to you to decide how much it
> weighs.
>
> The others didn't explain their motivation, either.

Though I feel like your intuition may prove more correct than my
motivated opinion, here's one:

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.

Filipp



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  8:02                     ` Filipp Gunbin
@ 2022-04-20  8:15                       ` Eli Zaretskii
  2022-04-20 10:27                         ` Filipp Gunbin
                                           ` (4 more replies)
  0 siblings, 5 replies; 36+ messages in thread
From: Eli Zaretskii @ 2022-04-20  8:15 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: yandros, emacs-devel, spwhitton

> 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.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  8:15                       ` Eli Zaretskii
@ 2022-04-20 10:27                         ` Filipp Gunbin
  2022-04-20 11:55                         ` Brian Cully
                                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 36+ messages in thread
From: Filipp Gunbin @ 2022-04-20 10:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: yandros, emacs-devel, spwhitton

On 20/04/2022 11:15 +0300, Eli Zaretskii wrote:

>> 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,

I think this is where our perception differs: I find it very much like
"go", partly because we move to the position in the current buffer, and
not some other.

> 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.

I don't use hi-lock regularly, but if I would, that would be exactly for
searching for some pattern.  Even if not in the sense of search-forward
/ isearch-forward.  And again, "s" in M-s can also mean "show"...

Oh, another key binding discussion :-)

Filipp



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  8:15                       ` Eli Zaretskii
  2022-04-20 10:27                         ` Filipp Gunbin
@ 2022-04-20 11:55                         ` Brian Cully
  2022-04-20 12:10                         ` Stefan Monnier
                                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 36+ messages in thread
From: Brian Cully @ 2022-04-20 11:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: yandros, emacs-devel, Filipp Gunbin, spwhitton


Eli Zaretskii <eliz@gnu.org> writes:
> 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?

	If I were not already very used to M-. to jump to a definition,
finding it under “M-g” would feel natural to me. Likewise, M-? being
bound under “M-s” also makes sense intuitively. The former, I do think
of as a “go” in spite of the name of the command, and the latter I think
of as a search.

	Funnily enough, while imenu is probably more closely related to
M-? -- being presented with a list of options to choose -- I think of it
more as a “go to”. I think the difference is context. Most of the time
when I invoke imenu, I *know* where I want to go, and imenu is what I
consider the fastest way to get there. When I invoke the other commands
I’m searching for something, but I don’t know precisely what yet.

	imenu obviously works in both contexts, so I’m just throwing in
my two cents. It feels more natural to me under M-g than M-s. I also use
M-g bindings way, way more often than M-s, which is probably skewing my
intuition. Heck, I have a custom imenu binding (“C-c j” for ’jump’) that
I probably use more often than all the commands under the M-s prefix
combined.

-bjc



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  8:15                       ` Eli Zaretskii
  2022-04-20 10:27                         ` Filipp Gunbin
  2022-04-20 11:55                         ` Brian Cully
@ 2022-04-20 12:10                         ` Stefan Monnier
  2022-04-20 15:53                           ` John Yates
  2022-04-20 16:43                           ` Sean Whitton
  2022-04-20 17:19                         ` chad
  2022-04-20 20:54                         ` Kévin Le Gouguec
  4 siblings, 2 replies; 36+ messages in thread
From: Stefan Monnier @ 2022-04-20 12:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Filipp Gunbin, yandros, emacs-devel, spwhitton

> 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?

Just to feed the discussion, I personally use `C-s` to go to
a particular line number (with a hack that adds line number NN as
a match when searching for "NN"), exactly because in my mind "search"
and "goto" are all jumbled up.  More specifically I got tired of my
muscle memory doing `C-s` when I needed to do `M-g M-g`, so I fixed
`C-s` to accommodate my muscle memory.


        Stefan




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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20 12:10                         ` Stefan Monnier
@ 2022-04-20 15:53                           ` John Yates
  2022-04-21 13:14                             ` Stefan Monnier
  2022-04-20 16:43                           ` Sean Whitton
  1 sibling, 1 reply; 36+ messages in thread
From: John Yates @ 2022-04-20 15:53 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Eli Zaretskii, spwhitton, Filipp Gunbin, yandros,
	Emacs developers

On Wed, Apr 20, 2022 at 8:11 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> I personally use `C-s` to go to
> a particular line number (with a hack that adds line number NN as
> a match when searching for "NN")

Would you be willing to share that snippet?

/john



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20 12:10                         ` Stefan Monnier
  2022-04-20 15:53                           ` John Yates
@ 2022-04-20 16:43                           ` Sean Whitton
  1 sibling, 0 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-20 16:43 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: yandros, Filipp Gunbin, emacs-devel

Hello,

On Wed 20 Apr 2022 at 08:10am -04, Stefan Monnier wrote:

>> 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?
>
> Just to feed the discussion, I personally use `C-s` to go to
> a particular line number (with a hack that adds line number NN as
> a match when searching for "NN"), exactly because in my mind "search"
> and "goto" are all jumbled up.  More specifically I got tired of my
> muscle memory doing `C-s` when I needed to do `M-g M-g`, so I fixed
> `C-s` to accommodate my muscle memory.

... and so 'M-g i' and 'M-g s' seem equally good to you?

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  8:15                       ` Eli Zaretskii
                                           ` (2 preceding siblings ...)
  2022-04-20 12:10                         ` Stefan Monnier
@ 2022-04-20 17:19                         ` chad
  2022-04-20 20:54                         ` Kévin Le Gouguec
  4 siblings, 0 replies; 36+ messages in thread
From: chad @ 2022-04-20 17:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: EMACS development team, Filipp Gunbin, Sean Whitton

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

I don't have a strong opinion in this area, as someone who doesn't use
imenu very much, but I feel like I was asked to support my intuition, so:

On Wed, Apr 20, 2022 at 4:15 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > 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?
>

 I *do* feel like C-u M-. is a "go" command, similar to the others, since
it prompts for input and "goes" there, but I also understand that the
difference between "go" and "find/search" is intentionally fuzzy in emacs.

I think C-x ` is another good example of a command that fits in the concept
that I recall suggested for M-g back when it was added, and I notice that
it actually has a binding in M-g, which I think supports the idea of M-g as
"go" and also that it's ok to have some longstanding "go" functionality be
bound both inside M-g and outside.

I hope that helps,
~Chad

[-- Attachment #2: Type: text/html, Size: 1734 bytes --]

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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  8:15                       ` Eli Zaretskii
                                           ` (3 preceding siblings ...)
  2022-04-20 17:19                         ` chad
@ 2022-04-20 20:54                         ` Kévin Le Gouguec
  2022-04-21  7:20                           ` Juri Linkov
  4 siblings, 1 reply; 36+ messages in thread
From: Kévin Le Gouguec @ 2022-04-20 20:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: yandros, spwhitton, Filipp Gunbin, emacs-devel

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.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20 20:54                         ` Kévin Le Gouguec
@ 2022-04-21  7:20                           ` Juri Linkov
  2022-04-21 15:36                             ` [External] : " Drew Adams
                                               ` (3 more replies)
  0 siblings, 4 replies; 36+ messages in thread
From: Juri Linkov @ 2022-04-21  7:20 UTC (permalink / raw)
  To: Kévin Le Gouguec
  Cc: Eli Zaretskii, emacs-devel, Filipp Gunbin, yandros, spwhitton

> * 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.

Do you think that additionally to 'M-g i' imenu should be bound also to 'M-g M-i'?
Then it could be typed without releasing the Meta modifier.  But the problem is
that 'M-i' is equivalent to 'TAB', so this means taking the keybinding 'M-g TAB'
that might have more sense for another command associated with TABs like
navigating to the next link, then 'M-g S-TAB' to the previous link, etc.



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20 15:53                           ` John Yates
@ 2022-04-21 13:14                             ` Stefan Monnier
  0 siblings, 0 replies; 36+ messages in thread
From: Stefan Monnier @ 2022-04-21 13:14 UTC (permalink / raw)
  To: John Yates
  Cc: Eli Zaretskii, Filipp Gunbin, yandros, Emacs developers,
	spwhitton

John Yates [2022-04-20 11:53:24] wrote:
> On Wed, Apr 20, 2022 at 8:11 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> I personally use `C-s` to go to
>> a particular line number (with a hack that adds line number NN as
>> a match when searching for "NN")
> Would you be willing to share that snippet?

I think the patch below is the relevant part.


        Stefan


diff --git a/lisp/isearch.el b/lisp/isearch.el
index be0227b6e75..17bf2b69828 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2778,6 +2828,8 @@ isearch-search-and-update
 	    ;; Unsuccessful regexp search may become successful by
 	    ;; addition of characters which make isearch-string valid
 	    isearch-regexp
+	    ;; Unsuccessful line search may become successful by adding chars.
+	    (string-match "\\`[0-9]+\\'" isearch-string)
 	    ;; If the string was found but was completely invisible,
 	    ;; it might now be partly visible, so try again.
 	    (prog1 isearch-hidden (setq isearch-hidden nil)))
@@ -3522,7 +3572,7 @@ isearch-lazy-count-format
 \f
 ;; Searching
 
-(defvar isearch-search-fun-function 'isearch-search-fun-default
+(defvar isearch-search-fun-function #'isearch-search-fun-default
   "Non-default value overrides the behavior of `isearch-search-fun-default'.
 This variable's value should be a function, which will be called
 with no arguments, and should return a function that takes three
@@ -3536,7 +3586,7 @@ isearch-search-fun-function
 (defun isearch-search-fun ()
   "Return the function to use for the search.
 Can be changed via `isearch-search-fun-function' for special needs."
-  (funcall (or isearch-search-fun-function 'isearch-search-fun-default)))
+  (funcall (or isearch-search-fun-function #'isearch-search-fun-default)))
 
 (defun isearch--lax-regexp-function-p ()
   "Non-nil if next regexp-function call should be lax."
@@ -3634,8 +3684,34 @@ isearch-search
 	    (retry t))
 	(setq isearch-error nil)
 	(while retry
-	  (setq isearch-success
-		(isearch-search-string isearch-string nil t))
+	  (let ((start (point))
+		(res
+		  (isearch-search-string isearch-string nil t)))
+	    ;; Look for a possible line-number.
+	    (when (and (save-match-data
+			 (string-match "\\`[0-9]+\\'" isearch-string))
+		       (not isearch-regexp))
+	      ;; Search from the barrier when entering the line-number and
+	      ;; not finding any other match.
+	      (unless (or res (equal isearch-string (isearch--state-string (car isearch-cmds))))
+		(setq start isearch-barrier))
+	      (let ((dest (save-excursion
+                            (goto-char (point-min))
+                            (forward-line
+                             (1- (string-to-number isearch-string)))
+			    (point))))
+		;; Match the line-number if relevant.
+		(when (and (funcall (if isearch-forward '> '<) dest start)
+			   (or (funcall (if isearch-forward '< '>)
+					dest (point))
+			       (null res)))
+		  (goto-char dest)
+		  (set-match-data (list (point)
+					(if isearch-forward
+					    (progn (end-of-line) (point))
+					  (line-end-position))))
+		  (setq res (point)))))
+	    (setq isearch-success res))
 	  ;; Clear RETRY unless the search predicate says
 	  ;; to skip this search hit.
 	  (if (or (not isearch-success)




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

* RE: [External] : Re: Proposal: add a binding for `imenu' under M-g
  2022-04-21  7:20                           ` Juri Linkov
@ 2022-04-21 15:36                             ` Drew Adams
  2022-04-21 17:50                             ` Howard Melman
                                               ` (2 subsequent siblings)
  3 siblings, 0 replies; 36+ messages in thread
From: Drew Adams @ 2022-04-21 15:36 UTC (permalink / raw)
  To: Juri Linkov, Kévin Le Gouguec
  Cc: Eli Zaretskii, spwhitton@spwhitton.name, Filipp Gunbin,
	yandros@gmail.com, emacs-devel@gnu.org

> Do you think that additionally to 'M-g i' imenu should be bound also to
> 'M-g M-i'?
> Then it could be typed without releasing the Meta modifier.

I'm speaking generally, here, not only, or necessarily,
about this particular binding.
___

It's generally (always?) true that M-<something>
followed by M-<something-else> is more convenient
than M-<something> followed by <something-else>.

But that's not, in itself, a reason to add the
former binding, in addition to the latter.

It generally makes more sense to do that when
the <something-else> provides a _repeatable_
action.  Why?  Because that's a case where you
particularly might want to just hold down the
last key, to repeat the action.

A command such as `imenu' is not such a case.
There's no use case for holding down the key
that invokes it.
___

Beyond this lack of a particular reason for
adding such a binding, is the general argument
not to multiply bindings unnecessarily (Occam).

Although today there might appear to be lots
of "free" keys to bind on `M-g', that's not a
good reason to foreclose their possible binding
to something else in the future.
___

And a M-<something> binding often has another
relation in Emacs to a <something> binding (or
to a C-<something>, or a C-M-<something>,
binding): it often provides an analogous or
similar operation.  Motion commands, for
instance.
___

Additional bindings for the same command can
always be added later, per popular acclaim.
I don't see a good reason to do that at the
outset.
___

For these reasons, I'd say leave `M-g M-i'
unbound, at least for now.  Binding `M-g i'
to `imenu' doesn't call for also binding
`M-g M-i' to it.

> But the problem is that 'M-i' is equivalent to
> 'TAB', so this means taking the keybinding
> 'M-g TAB' that might have more sense for another
> command associated with TABs like navigating to
> the next link, then 'M-g S-TAB' to the previous
> link, etc.

Yes, for example.

There are a plethora of existing and potential
"goto" commands - candidates for consideration
for `M-g'.  Let's not be in a hurry to give any
command multiple `M-g' bindings.


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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-21  7:20                           ` Juri Linkov
  2022-04-21 15:36                             ` [External] : " Drew Adams
@ 2022-04-21 17:50                             ` Howard Melman
  2022-04-22  3:37                               ` Sean Whitton
  2022-04-21 17:54                             ` Kévin Le Gouguec
  2022-04-21 19:03                             ` Sean Whitton
  3 siblings, 1 reply; 36+ messages in thread
From: Howard Melman @ 2022-04-21 17:50 UTC (permalink / raw)
  To: emacs-devel


Juri Linkov <juri@linkov.net> writes:

> Do you think that additionally to 'M-g i' imenu should be
> bound also to 'M-g M-i'?  Then it could be typed without
> releasing the Meta modifier.  But the problem is that
> 'M-i' is equivalent to 'TAB', so this means taking the
> keybinding 'M-g TAB' that might have more sense for
> another command associated with TABs like navigating to
> the next link, then 'M-g S-TAB' to the previous link, etc.

I don't think imenu deserves two bindings and 'M-g i' is easy enough.

FWIW I use the consult package and bind, as follows:

    (global-set-key (kbd "M-g i") 'consult-imenu)
    (global-set-key (kbd "M-g M-i") 'consult-imenu-multi)

The second allows completion from the imenu of all buffers
in the same project with the same major mode.

Consult itself doesn't bind these commands but suggests
'M-g 'i and 'M-g I' (capital i).

-- 

Howard




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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-21  7:20                           ` Juri Linkov
  2022-04-21 15:36                             ` [External] : " Drew Adams
  2022-04-21 17:50                             ` Howard Melman
@ 2022-04-21 17:54                             ` Kévin Le Gouguec
  2022-04-21 19:03                             ` Sean Whitton
  3 siblings, 0 replies; 36+ messages in thread
From: Kévin Le Gouguec @ 2022-04-21 17:54 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Zaretskii, emacs-devel, Filipp Gunbin, yandros, spwhitton

Juri Linkov <juri@linkov.net> writes:

> Do you think that additionally to 'M-g i' imenu should be bound also to 'M-g M-i'?
> Then it could be typed without releasing the Meta modifier.  

After long years of training, I think I've finally managed to get my
fingers to reliably lift off Control and Meta after initiating a prefix,
so I personally wouldn't mind just M-g i (I say, after typing "juts
M-DEL" ten times before finally succeeding in typing "just"); but I
think making the binding easier on the fingers is a worthy goal.

Bottomline: sure?

>                                                              But the problem is
> that 'M-i' is equivalent to 'TAB'

Is it?  C-i is equivalent to TAB as far as I'm aware; M-i is only
equivalent to ESC I… or am I missing something?



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-20  6:38                   ` Eli Zaretskii
  2022-04-20  8:02                     ` Filipp Gunbin
@ 2022-04-21 19:01                     ` Sean Whitton
  1 sibling, 0 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-21 19:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: yandros, fgunbin, emacs-devel

Hello,

On Wed 20 Apr 2022 at 09:38AM +03, Eli Zaretskii wrote:

> I don't know in what units to measure that and how, sorry.  It's just
> an intuitive feeling of having my proverbial brow raise when I saw the
> suggestion, that's all.  I think it's up to you to decide how much it
> weighs.
>
> The others didn't explain their motivation, either.

Cool.  As I mentioned, I am neutral between the options myself.
However, aftering reviewing the whole thread again, I'm led to conclude
that most people will find 'M-g i' more intuitive and thus easier to
memorize.  So I've bound it to that on master.

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-21  7:20                           ` Juri Linkov
                                               ` (2 preceding siblings ...)
  2022-04-21 17:54                             ` Kévin Le Gouguec
@ 2022-04-21 19:03                             ` Sean Whitton
  3 siblings, 0 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-21 19:03 UTC (permalink / raw)
  To: Juri Linkov, Kévin Le Gouguec
  Cc: Eli Zaretskii, Filipp Gunbin, yandros, emacs-devel

Hello,

On Thu 21 Apr 2022 at 10:20AM +03, Juri Linkov wrote:

>> * 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.
>
> Do you think that additionally to 'M-g i' imenu should be bound also to 'M-g M-i'?
> Then it could be typed without releasing the Meta modifier.  But the problem is
> that 'M-i' is equivalent to 'TAB', so this means taking the keybinding 'M-g TAB'
> that might have more sense for another command associated with TABs like
> navigating to the next link, then 'M-g S-TAB' to the previous link, etc.

I don't object but it doesn't seem useful to me, for the following
reason.  g and i are on opposite halves of qwerty, so if you're touch
typing properly then you would use a different Alt key to type each of
M-g and M-i.  Then M-g M-i is four keypresses whereas M-g i is three.

-- 
Sean Whitton



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

* Re: Proposal: add a binding for `imenu' under M-g
  2022-04-21 17:50                             ` Howard Melman
@ 2022-04-22  3:37                               ` Sean Whitton
  0 siblings, 0 replies; 36+ messages in thread
From: Sean Whitton @ 2022-04-22  3:37 UTC (permalink / raw)
  To: Howard Melman, emacs-devel

Hello,

On Thu 21 Apr 2022 at 01:50pm -04, Howard Melman wrote:

> Juri Linkov <juri@linkov.net> writes:
>
>> Do you think that additionally to 'M-g i' imenu should be
>> bound also to 'M-g M-i'?  Then it could be typed without
>> releasing the Meta modifier.  But the problem is that
>> 'M-i' is equivalent to 'TAB', so this means taking the
>> keybinding 'M-g TAB' that might have more sense for
>> another command associated with TABs like navigating to
>> the next link, then 'M-g S-TAB' to the previous link, etc.
>
> I don't think imenu deserves two bindings and 'M-g i' is easy enough.
>
> FWIW I use the consult package and bind, as follows:
>
>     (global-set-key (kbd "M-g i") 'consult-imenu)
>     (global-set-key (kbd "M-g M-i") 'consult-imenu-multi)
>
> The second allows completion from the imenu of all buffers
> in the same project with the same major mode.
>
> Consult itself doesn't bind these commands but suggests
> 'M-g 'i and 'M-g I' (capital i).

Huh, interesting that 'M-g i' occurred independently to the consult devs.

-- 
Sean Whitton



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

end of thread, other threads:[~2022-04-22  3:37 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08 15:36 Proposal: add a binding for `imenu' under M-g Sean Whitton
2022-04-14 14:16 ` Sean Whitton
2022-04-14 16:14   ` Eli Zaretskii
2022-04-14 17:21     ` Filipp Gunbin
2022-04-14 18:00       ` Sean Whitton
2022-04-14 18:12       ` Eli Zaretskii
2022-04-14 19:03         ` chad
2022-04-15  5:51           ` Eli Zaretskii
2022-04-15  6:45             ` Sean Whitton
2022-04-15  6:50               ` Eli Zaretskii
2022-04-15 17:16                 ` Howard Melman
2022-04-15 17:16                 ` Howard Melman
2022-04-20  5:15                 ` Sean Whitton
2022-04-20  6:38                   ` Eli Zaretskii
2022-04-20  8:02                     ` Filipp Gunbin
2022-04-20  8:15                       ` Eli Zaretskii
2022-04-20 10:27                         ` Filipp Gunbin
2022-04-20 11:55                         ` Brian Cully
2022-04-20 12:10                         ` Stefan Monnier
2022-04-20 15:53                           ` John Yates
2022-04-21 13:14                             ` Stefan Monnier
2022-04-20 16:43                           ` Sean Whitton
2022-04-20 17:19                         ` chad
2022-04-20 20:54                         ` Kévin Le Gouguec
2022-04-21  7:20                           ` Juri Linkov
2022-04-21 15:36                             ` [External] : " Drew Adams
2022-04-21 17:50                             ` Howard Melman
2022-04-22  3:37                               ` Sean Whitton
2022-04-21 17:54                             ` Kévin Le Gouguec
2022-04-21 19:03                             ` Sean Whitton
2022-04-21 19:01                     ` Sean Whitton
2022-04-14 19:37         ` Sean Whitton
2022-04-14 19:52           ` [External] : " Drew Adams
2022-04-19 14:21           ` Stephen Leake
2022-04-14 19:47         ` [External] : " Drew Adams
2022-04-14 16:24   ` Filipp Gunbin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).