emacs-devel
[Top][All Lists]
Advanced

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

Re: position on changing defaults?


From: Juri Linkov
Subject: Re: position on changing defaults?
Date: Thu, 06 Mar 2008 02:21:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

>> Unfortunately, I see no way of implementing this in simple.el without
>> using pre-command-hook and post-command-hook.  It seems this can be
>> implemented only in C in the function that reads characters.
>
> I was thinking about we might do this in a better and more general way
> (in C, obviously).
>
> How about adding a new type of binding, a "modifier binding", which
> could serve to implement CUA movement, and replace the current automatic
> S-foo => foo remapping.
>
> Basically, these would be bindings that represent event-modifiers only.
> If normal key lookup fails, the keymapping mechanism would then look up
> and invoke the modifier binding corresponding to the modifiers on the
> key, and invoke it instead; the invoked function could then, if it
> wished (e.g. for CUA), set some variables or frob some state and
> re-invoke the event with the modifiers removed.
>
> [Presumably there would be some fallback mechanism for dealing with
> multiple modifiers where there was no binding for the entire modifier
> set; e.g., if the event was "S-M-x", and there was no "S-M-x" binding,
> nor a "S-M-" binding, it would then lookup say "S-" and "M-" in turn,
> and invoke the first one found.]
>
> Whadaya think?

In general, I agree with the idea of exposing the translation of unbound
event-modified keys to Lisp functions that can process untranslated keys.
Maybe it would be possible to implement the following interface to define
such bindings?

(define-key global-map [(shift untranslated)]
  (lambda ()
    (interactive)
    (when (and transient-mark-mode (not mark-active))
       (push-mark-command nil nil))))

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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