[Top][All Lists]

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

Re: Emacs completion matches selection UI

From: Ted Zlatanov
Subject: Re: Emacs completion matches selection UI
Date: Mon, 06 Jan 2014 18:48:06 -0500
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

On Sun, 05 Jan 2014 11:11:00 -0500 Stefan Monnier <address@hidden> wrote: 

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

SM> We could do the above fairly easily with

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

Please, no.  It's a real pain to debug this with a user.

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

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

I think the mykie.el approach has potential here ;)


reply via email to

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