[Top][All Lists]

[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: Sun, 05 Jan 2014 11:11:00 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>>> (define-fallbackish-command maybe-foo (kbd "[somekey]") ()
>> I don't understand what's the intended relation between [somekey] and
>> `maybe-foo'.
> Sorry, I should have provided some implementation, or made this more
> clear. I
> The generated part of the `maybe-foo' would do two things:
> * register the association between maybe-foo and [somekey] in a some
>   global variable, pushing in front of any existing ones also defined
>   with the same macro. This keeps track of the "fallbackish commands"
>   (horrible name, sorry) for [somekey]
> * bind maybe-foo to [somekey] in the (global) keymap, maybe replacing
>   someone else's binding.

We could do the above fairly easily with

  (add-function :around (lookup-key global-map [somekey])
                (lambda (orig &rest args)
                  (if (foop) (foo) (apply orig args))))

> I have no idea how it would work with multiple keymaps.

Right, that's where it gets more interesting.  E.g. some major mode
might want to extend the meaning of TAB, but it should do it in the
major mode's map, not in the global map.


reply via email to

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