emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs completion matches selection UI


From: Stefan Monnier
Subject: Re: Emacs completion matches selection UI
Date: Sat, 04 Jan 2014 18:02:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> Yes.  We should make it easier to extend indent-for-tab-command.
> Do you think it's possible/desirable to generalize this mechanism (to
> support the "fallback-maybe" pattern) so that we can make it easier to
> extend any command, not just indent-for-tab-command?

Everything's possible and yes, I think there's interest in supporting
this cleanly.  There are different approaches, tho.

One is advice-add.  This makes it possible to extend a command with new
behavior, with a clean and simple fallback mechanism.

If OTOH you want to "extend a key-binding", we don't have a good story.
You can do things like

   (define-key map [?\C-i]
     `(menu-item "" mycommand
       :filter ,(lambda (cmd) (if <pred> cmd))))

which will use `mycommand' if <pred> is true and fallback on the next
binding otherwise.  But this is not very satisfactory:
- no way to do something after the fallback command is run.
- C-h k will only tell you about one of the possible commands.
- Can't have more than one such "conditional binding" for the same key
  in the same keymap.

> (define-fallbackish-command maybe-foo (kbd "[somekey]") ()

I don't understand what's the intended relation between [somekey] and
`maybe-foo'.


        Stefan



reply via email to

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