all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Showing all sequences bound to a prefix?
@ 2009-09-02 10:28 Elena
  2009-09-02 10:36 ` Anselm Helbig
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Elena @ 2009-09-02 10:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

how can you know all keybindings which start with a key? For instance,
"C-h c" asks me to enter a key. If I enter "C-w" it waits for more
input, which means that "C-w" is a prefix.

Thanks


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

* Re: Showing all sequences bound to a prefix?
  2009-09-02 10:28 Showing all sequences bound to a prefix? Elena
@ 2009-09-02 10:36 ` Anselm Helbig
  2009-09-02 15:04   ` Drew Adams
       [not found]   ` <mailman.5863.1251903856.2239.help-gnu-emacs@gnu.org>
  2009-09-02 13:01 ` Peter Dyballa
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Anselm Helbig @ 2009-09-02 10:36 UTC (permalink / raw)
  To: help-gnu-emacs

At Wed, 2 Sep 2009 03:28:03 -0700 (PDT),
Elena <egarrulo@gmail.com> wrote:
> 
> Hello,
> 
> how can you know all keybindings which start with a key? For instance,
> "C-h c" asks me to enter a key. If I enter "C-w" it waits for more
> input, which means that "C-w" is a prefix.

Use C-h, e.g. `C-x r C-h' will show you all key bindings starting with
`C-x r'.

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


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

* Re: Showing all sequences bound to a prefix?
  2009-09-02 10:28 Showing all sequences bound to a prefix? Elena
  2009-09-02 10:36 ` Anselm Helbig
@ 2009-09-02 13:01 ` Peter Dyballa
  2009-09-02 15:04 ` Drew Adams
       [not found] ` <mailman.5864.1251903863.2239.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 14+ messages in thread
From: Peter Dyballa @ 2009-09-02 13:01 UTC (permalink / raw)
  To: Elena; +Cc: help-gnu-emacs


Am 02.09.2009 um 12:28 schrieb Elena:

> how can you know all keybindings which start with a key?


C-h b, copy the output to *scratch* buffer for example or make the  
*Help* writable, sort the lines. Or apply a shell command with sort  
on the *Help* buffer's contents. Then you could grep for what you are  
interested...

--
Greetings

   Pete

  "A designer knows he has arrived at perfection not when there is no  
longer anything to add, but when there is no longer anything to take  
away."
				– Antoine de Saint-Exupéry







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

* RE: Showing all sequences bound to a prefix?
  2009-09-02 10:36 ` Anselm Helbig
@ 2009-09-02 15:04   ` Drew Adams
       [not found]   ` <mailman.5863.1251903856.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-09-02 15:04 UTC (permalink / raw)
  To: 'Anselm Helbig', help-gnu-emacs

> > how can you know all keybindings which start with a key? 
> For instance,
> > "C-h c" asks me to enter a key. If I enter "C-w" it waits for more
> > input, which means that "C-w" is a prefix.
> 
> Use C-h, e.g. `C-x r C-h' will show you all key bindings starting with
> `C-x r'.

That doesn't always work. Try C-s C-h, for instance.





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

* RE: Showing all sequences bound to a prefix?
  2009-09-02 10:28 Showing all sequences bound to a prefix? Elena
  2009-09-02 10:36 ` Anselm Helbig
  2009-09-02 13:01 ` Peter Dyballa
@ 2009-09-02 15:04 ` Drew Adams
       [not found] ` <mailman.5864.1251903863.2239.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-09-02 15:04 UTC (permalink / raw)
  To: 'Elena', help-gnu-emacs

> how can you know all keybindings which start with a key? For instance,
> "C-h c" asks me to enter a key. If I enter "C-w" it waits for more
> input, which means that "C-w" is a prefix.

Icicles key completion. 
http://www.emacswiki.org/emacs/Icicles_-_Key_Completion

(BTW, C-w is not normally a prefix key in Emacs. You or some library you load
has defined it as a prefix key.)

If C-w is a prefix key for you, then C-w S-TAB shows you all of the completions
for C-w: each suffix key with its associated command. Similarly, `C-x r S-TAB'
shows all of the completions of prefix key `C-x r':

..
+  =  increment-register
b  =  bookmark-jump
c  =  clear-rectangle
C-@  =  point-to-register
C-SPC  =  point-to-register
d  =  delete-rectangle
f  =  frame-configuration-to-register
g  =  insert-register
i  =  insert-register
j  =  jump-to-register
k  =  kill-rectangle
l  =  bookmark-bmenu-list
n  =  number-to-register
o  =  open-rectangle
r  =  copy-rectangle-to-register
s  =  copy-to-register
SPC  =  point-to-register
t  =  string-rectangle
w  =  window-configuration-to-register
x  =  copy-to-register
y  =  yank-rectangle

While completing, you can get the full help (in *Help*) for any key/command, by
cycling to it and hitting `C-M-RET'. For example, cycling to the third
completion, `c  = clear-rectangle', and hitting `C-M-RET', shows this:

,----
| clear-rectangle is an interactive autoloaded Lisp function in `rect'.
| 
| It is bound to C-x r c.
| 
| (clear-rectangle START END &optional FILL)
| 
| Blank out the region-rectangle.
| The text previously in the region is overwritten with blanks.
| 
| When called from a program the rectangle's corners are START and END.
| With a prefix (or a FILL) argument, also fill with blanks the parts of the
| rectangle which were empty.
| 
`----

You don't need to cycle - you can use completion instead. And you can filter
completion candidates by just typing some text. For example, type `rect' to
narrow the completions of `C-x r' to those keys that act on rectangles:

c  =  clear-rectangle
d  =  delete-rectangle
k  =  kill-rectangle
o  =  open-rectangle 
r  =  copy-rectangle-to-register
t  =  string-rectangle
y  =  yank-rectangle

Once you've chosen a completion, hit RET to use it, or C-g to quit. IOW, you can
use this either to complete a key, performing its action, or just to get help on
keys.





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

* Re: Showing all sequences bound to a prefix?
       [not found]   ` <mailman.5863.1251903856.2239.help-gnu-emacs@gnu.org>
@ 2009-09-02 15:35     ` Anselm Helbig
  2009-09-02 16:40       ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Anselm Helbig @ 2009-09-02 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

At Wed, 2 Sep 2009 08:04:28 -0700,
"Drew Adams" <drew.adams@oracle.com> wrote:
> 
> > > how can you know all keybindings which start with a key? 
> > For instance,
> > > "C-h c" asks me to enter a key. If I enter "C-w" it waits for more
> > > input, which means that "C-w" is a prefix.
> > 
> > Use C-h, e.g. `C-x r C-h' will show you all key bindings starting with
> > `C-x r'.
> 
> That doesn't always work. Try C-s C-h, for instance.

C-s is not a key sequence, in that case you can always use C-h k. Do
you have a better example for when C-h breaks? I agree that it is not
guaranteed to work, but it's a well established convention not to bind
C-h in a key sequence to something else.


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


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

* Re: Showing all sequences bound to a prefix?
       [not found] ` <mailman.5864.1251903863.2239.help-gnu-emacs@gnu.org>
@ 2009-09-02 15:55   ` Anselm Helbig
  2009-09-02 16:47     ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Anselm Helbig @ 2009-09-02 15:55 UTC (permalink / raw)
  To: help-gnu-emacs

At Wed, 2 Sep 2009 08:04:33 -0700,
"Drew Adams" <drew.adams@oracle.com> wrote:
> 
> > how can you know all keybindings which start with a key? For instance,
> > "C-h c" asks me to enter a key. If I enter "C-w" it waits for more
> > input, which means that "C-w" is a prefix.
> 
> Icicles key completion. 

But this only works with Iciclemacs, of course. 8;-)


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


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

* RE: Showing all sequences bound to a prefix?
  2009-09-02 15:35     ` Anselm Helbig
@ 2009-09-02 16:40       ` Drew Adams
  2009-09-03  4:19         ` Kevin Rodgers
  2009-09-03 10:26         ` Bernardo
  0 siblings, 2 replies; 14+ messages in thread
From: Drew Adams @ 2009-09-02 16:40 UTC (permalink / raw)
  To: 'Anselm Helbig', help-gnu-emacs

> > > > how can you know all keybindings which start with a key? 
> > > > For instance, "C-h c" asks me to enter a key. If I enter
> > > > "C-w" it waits for more input, which means that "C-w"
> > > > is a prefix.
> > > 
> > > Use C-h, e.g. `C-x r C-h' will show you all key bindings 
> > > starting with `C-x r'.
> > 
> > That doesn't always work. Try C-s C-h, for instance.
> 
> C-s is not a key sequence 

Huh? The only reason `C-s C-h' does not work (show you the isearch bindings) is
because RMS did not want it to work. He prefers that `C-h' break out of isearch
(and so initiate global help).

(isearch+.el does let `C-s C-h' give you isearch help, including listing all of
the bindings - http://www.emacswiki.org/emacs/IsearchPlus)

> in that case you can always use C-h k.

How will C-h k help you discover the isearch keys? Sure, if you already know
that `C-s M-s w' is one of the isearch keys, then you can use `C-h k C-s M-s w'
to discover that its command is `isearch-toggle-word'. But you can't discover
the keys using `C-h k' (except by trying all keys).

`C-h f isearch-forward' gives you information about the isearch keys.

Another possibility for listing the keys in the `isearch-mode-map' is to use
library help-fns+.el, and use `C-h C-k isearch-mode-map'.
http://www.emacswiki.org/emacs/HelpPlus

> Do you have a better example for when C-h breaks?

Not offhand. I used to know some, but things change with every version of Emacs,
and I've fixed this long ago locally, so I don't keep track of which
combinations don't work in vanilla Emacs. Maybe `C-s C-h' is the only one
nowadays - dunno.

> I agree that it is not guaranteed to work, but it's a well
> established convention not to bind C-h in a key sequence to
> something else.

Agreed: (a) it might not work (my point), and (b) it's good to let it work, when
it does.

And it's good that you mentioned `C-h' as a means to discover the suffix keys
for a prefix key. I just wanted to point out that it might not work in some
cases.





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

* RE: Showing all sequences bound to a prefix?
  2009-09-02 15:55   ` Anselm Helbig
@ 2009-09-02 16:47     ` Drew Adams
  0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-09-02 16:47 UTC (permalink / raw)
  To: 'Anselm Helbig', help-gnu-emacs

> > > how can you know all keybindings which start with a key? 
> > > For instance, "C-h c" asks me to enter a key. If I enter
> > > "C-w" it waits for more input, which means that "C-w" is a prefix.
> > 
> > Icicles key completion. 
> 
> But this only works with Iciclemacs, of course. 8;-)

Of course. ;-)

To be clear, it works with GNU Emacs 22 and 23, in Icicle minor mode (after
loading the Icicles libraries). If you turn off Icicle mode, it stops working
until you turn it on again. ;-)






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

* Re: Showing all sequences bound to a prefix?
  2009-09-02 16:40       ` Drew Adams
@ 2009-09-03  4:19         ` Kevin Rodgers
  2009-09-03  5:32           ` Drew Adams
       [not found]           ` <mailman.5923.1251955964.2239.help-gnu-emacs@gnu.org>
  2009-09-03 10:26         ` Bernardo
  1 sibling, 2 replies; 14+ messages in thread
From: Kevin Rodgers @ 2009-09-03  4:19 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:
>>>>> how can you know all keybindings which start with a key? 
>>>>> For instance, "C-h c" asks me to enter a key. If I enter
>>>>> "C-w" it waits for more input, which means that "C-w"
>>>>> is a prefix.
>>>> Use C-h, e.g. `C-x r C-h' will show you all key bindings 
>>>> starting with `C-x r'.
>>> That doesn't always work. Try C-s C-h, for instance.
>> C-s is not a key sequence 

I think Anselm meant "C-s is not a prefix key".

> Huh? The only reason `C-s C-h' does not work (show you the isearch bindings) is
> because RMS did not want it to work. He prefers that `C-h' break out of isearch
> (and so initiate global help).

`C-s C-h' does not work the way e.g. `C-x r C-h' works because `C-s' is not a
prefix key.  `C-s C-h' does not work the way you and I want it to work because
`C-s' invokes a transient mode (incremental search) with its own keymap, which
implies that `C-h' must be bound to mode-specific command in that keymap, and
RMS prefers a different binding than we do.

 > (isearch+.el does let `C-s C-h' give you isearch help, including listing all of
 > the bindings - http://www.emacswiki.org/emacs/IsearchPlus)

Or just put this in your ~/.emacs:

(define-key isearch-mode-map "\C-h" 'isearch-mode-help)

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* RE: Showing all sequences bound to a prefix?
  2009-09-03  4:19         ` Kevin Rodgers
@ 2009-09-03  5:32           ` Drew Adams
       [not found]           ` <mailman.5923.1251955964.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-09-03  5:32 UTC (permalink / raw)
  To: 'Kevin Rodgers', help-gnu-emacs

> > The only reason `C-s C-h' does not work (show you the 
> > isearch bindings) is because RMS did not want it to work.
> > He prefers that `C-h' break out of isearch
> > (and so initiate global help).
> 
> `C-s C-h' does not work the way e.g. `C-x r C-h' works 
> because `C-s' is not a prefix key.

The discussion wasn't only about working "the way C-x r C-h works" - the goal
was to see the isearch key bindings. Which is why I explicitly said "does not
work (show you the isearch bindings)".

The "does not work" in this general sense of showing you the isearch bindings is
not "because C-s is not a prefix key". That explains why `C-s' doesn't work the
same as `C-x r', but it doesn't explain why `C-s C-h' doesn't show you isearch
help (bindings).

There is nothing about not being a prefix key that prevents having C-s C-h show
the isearch bindings. As has been said, it can easily be made to work (show the
bindings), by just binding C-h to isearch-mode-help in isearch-mode-map. It's
not a technical problem.

The *reason* that that binding has not been made in Emacs (it has been proposed
several times), and thus the reason that C-s C-h does not work (does not show
you the isearch bindings), is because Richard does not want C-h during isearch
to offer isearch help. He wants it to exit isearch and offer global, top-level
help. It is not a technical reason, but a UI choice.

> `C-s C-h' does not work the way you and I want it to work because
> `C-s' invokes a transient mode (incremental search) with its 
> own keymap, which implies that `C-h' must be bound to
> mode-specific command in that keymap,

Yes.

> and RMS prefers a different binding than we do.

Yes.

But there is no relation between the last clause and the first part of the
sentence. The first part explains why C-s C-h doesn't _automatically_ work (the
way C-x r C-h does). But all that matters for the desired result is the second
part: it wasn't implemented because of a UI design choice - the implementation
is then irrelevant.





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

* Re: Showing all sequences bound to a prefix?
       [not found]           ` <mailman.5923.1251955964.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03  6:38             ` Anselm Helbig
  2009-09-03  7:42               ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Anselm Helbig @ 2009-09-03  6:38 UTC (permalink / raw)
  To: help-gnu-emacs

At Wed, 2 Sep 2009 22:32:35 -0700,
"Drew Adams" <drew.adams@oracle.com> wrote:
> 
> > > The only reason `C-s C-h' does not work (show you the 
> > > isearch bindings) is because RMS did not want it to work.
> > > He prefers that `C-h' break out of isearch
> > > (and so initiate global help).
> > 
> > `C-s C-h' does not work the way e.g. `C-x r C-h' works 
> > because `C-s' is not a prefix key.
> 
> The discussion wasn't only about working "the way C-x r C-h works" - the goal
> was to see the isearch key bindings. Which is why I explicitly said "does not
> work (show you the isearch bindings)".

Well, you want to discuss it, Drew. 8;-) The OP wanted to find out
about key sequences with a common prefix.


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


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

* RE: Showing all sequences bound to a prefix?
  2009-09-03  6:38             ` Anselm Helbig
@ 2009-09-03  7:42               ` Drew Adams
  0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-09-03  7:42 UTC (permalink / raw)
  To: 'Anselm Helbig', help-gnu-emacs

> > The discussion wasn't only about working "the way C-x r C-h 
> > works" - the goal was to see the isearch key bindings.
> > Which is why I explicitly said "does not
> > work (show you the isearch bindings)".
> 
> Well, you want to discuss it, Drew. 8;-) The OP wanted to find out
> about key sequences with a common prefix.

Oops; you're right, and I'm wrong.

I lost sight of the original question, and somehow thought it was about C-s C-h.
Your explanation and Kevin's were 100% apropos the question.

Sorry about that.





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

* Re: Showing all sequences bound to a prefix?
  2009-09-02 16:40       ` Drew Adams
  2009-09-03  4:19         ` Kevin Rodgers
@ 2009-09-03 10:26         ` Bernardo
  1 sibling, 0 replies; 14+ messages in thread
From: Bernardo @ 2009-09-03 10:26 UTC (permalink / raw)
  To: help-gnu-emacs



> 
> Huh? The only reason `C-s C-h' does not work (show you the isearch bindings) is

somewhat off topic, but still interesting - C-s C-h b will do the trick

,----[ (info "(emacs) Special Isearch") ]
|  ...
|    When incremental search is active, you can type `C-h C-h' to access
| interactive help options, including a list of special keybindings.
| These keybindings are part of the keymap `isearch-mode-map' (*note
| Keymaps::).
`----




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

end of thread, other threads:[~2009-09-03 10:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-02 10:28 Showing all sequences bound to a prefix? Elena
2009-09-02 10:36 ` Anselm Helbig
2009-09-02 15:04   ` Drew Adams
     [not found]   ` <mailman.5863.1251903856.2239.help-gnu-emacs@gnu.org>
2009-09-02 15:35     ` Anselm Helbig
2009-09-02 16:40       ` Drew Adams
2009-09-03  4:19         ` Kevin Rodgers
2009-09-03  5:32           ` Drew Adams
     [not found]           ` <mailman.5923.1251955964.2239.help-gnu-emacs@gnu.org>
2009-09-03  6:38             ` Anselm Helbig
2009-09-03  7:42               ` Drew Adams
2009-09-03 10:26         ` Bernardo
2009-09-02 13:01 ` Peter Dyballa
2009-09-02 15:04 ` Drew Adams
     [not found] ` <mailman.5864.1251903863.2239.help-gnu-emacs@gnu.org>
2009-09-02 15:55   ` Anselm Helbig
2009-09-02 16:47     ` Drew Adams

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.