[Top][All Lists]

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

Re: position on changing defaults?

From: Stefan Monnier
Subject: Re: position on changing defaults?
Date: Sat, 08 Mar 2008 15:09:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> Obviously, this can't work as is.  Maybe an even better generalization
>> would be
>> (define-key function-key-map [is-shifted-p]
>> (lambda (prompt key) (vector (remove-shift key))))
>> (define-key function-key-map [is-mouse-4-p]
>> (lambda (prompt key)
>> (vector (combine-modifiers (modifiers key) 'mwheel-up)))
>> where `is-shifted-p' and `is-mouse-4-p' are Lisp functions.

> The argument against using pre-command-hook and post-command-hook is 
> efficiency

Actually, for me it is not.  The issue is reliability, maintainability
and debuggability.

This said, the use of a function-key-map binding which sets a variable
is just as bad as a pre-command-hook, if not worse.

OTOH I find the above two examples of "generic function-key-map
bindings" desirable.  Note that they have nothing to do with
pre-command-hook: they just move a hardcoded C-level feature to elisp
(well, the first is in C, the other doesn't exist because I don't want to
add it to the C code but I don't have any clean way to do it in elisp
right now).  More specifically, I feel like anything that will help
reduce the complexity of read_key_sequence is desirable.


PS: And yes, I plead guilty to adding input-decode-map recently which made
it more complex.

reply via email to

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