[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7631: 24.0.50; inconsistency in event-convert-list and event-basic-t
From: |
Don March |
Subject: |
bug#7631: 24.0.50; inconsistency in event-convert-list and event-basic-type |
Date: |
Mon, 13 Dec 2010 22:36:20 -0500 |
On Mon, Dec 13, 2010 at 1:01 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> (event-convert-list '(t)) ; => 116
>
>> There's good reason to want this to eval to t (i.e. the symbol, not
>> the char).
>
> Could you explain what is this good reason?
I guess it boils down to the expected result of:
(setq event t)
(event-convert-list
(append (event-modifiers event)
(list (event-basic-type event)))) ; => 116, not t
In my mind, this should be an identity function (in the mathematical
sense) for events; if you take the event-modifiers and the
event-basic-type and then splice them together, the result should be
the original event.
A simplified version of what I was doing when I found this (which may
or may not be important) was something along the lines of:
(defun swap-C-and-M (event)
(event-convert-list
(append
(mapcar (lambda (x) (case x
('control 'meta)
('meta 'control)
('click nil)
(t x)))
(event-modifiers event))
(list (event-basic-type event)))))
(setq new-keymap (make-sparse-keymap))
(map-keymap (lambda (key def)
(define-key new-keymap
(vector (swap-C-and-M key))
def))
isearch-mode-map)
(swap-C-and-M ?\M-x) ; => 24
(swap-C-and-M 'foo) ; => foo
(swap-C-and-M t) ; => 116
(lookup-key new-keymap [?t]) ; => isearch-other-control-char
(lookup-key new-keymap [t]) ; => nil