GNU bug report logs - #7631
24.0.50; inconsistency in event-convert-list and event-basic-type

Previous Next

Package: emacs;

Reported by: Don March <don <at> ohspite.net>

Date: Mon, 13 Dec 2010 06:17:02 UTC

Severity: normal

Tags: moreinfo

Found in version 24.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 7631 <at> debbugs.gnu.org (full text, mbox):

From: Don March <don <at> ohspite.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7631 <at> debbugs.gnu.org
Subject: Re: 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 <at> 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




This bug report was last modified 3 years and 306 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.