[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestion: Simple way to make conditional key bindings.
From: |
Stefan Monnier |
Subject: |
Re: Suggestion: Simple way to make conditional key bindings. |
Date: |
Mon, 26 Aug 2002 12:21:18 -0400 |
> One advantage (IMO) is that C-h k C-y will report yank or
> yank-with-properties depending on the actual function taken if
> you hit C-y.
>
> If we use menu-item, what will C-h c say?
Same thing (it runs the filter).
> (define-key global-map "\C-y" 'yank-careful)
> (defun yank-careful (...)
> "Reinsert the last stretch of killed text, like `yank'.
> Contrary to `yank' this function is careful to preserve some important
> text properties when yanking tables."
> ...)
>
> The advantage is that C-h k C-y doesn't just give you one of the two
> bindings but a docstring that describes both.
>
> I think that sometimes this will be better, but sometimes it will be
> better for C-h k to give the doc string for the specific command
> that will be executed.
Agreed. But in the example he gave I think that a docstring that
describes the range of behavior rather than the specific command is
better, because you can't expect the user to know that the current
string is "special".
I think that whether the docstring should cover all the possible behaviors
or just the specific current one depends on how what the behavior depends on:
if it's very implicit and/or changes often the first is preferable.
This is the case for his example.
OTOH if it's explicit and/or doesn't change often, then the latter is
preferable. This is the case (and the current behavior) for minor modes.
Stefan
- Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings., David PONCE, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings., Stefan Monnier, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/25
- Re: Suggestion: Simple way to make conditional key bindings., Stefan Monnier, 2002/08/26
- Re: Suggestion: Simple way to make conditional key bindings., Miles Bader, 2002/08/26
- Re: Suggestion: Simple way to make conditional key bindings., Richard Stallman, 2002/08/27
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/27
- Re: Suggestion: Simple way to make conditional key bindings., Richard Stallman, 2002/08/28