GNU bug report logs -
#7541
24.0.50; define-key error message for non-prefix M-[char]
Previous Next
Reported by: Don March <don <at> ohspite.net>
Date: Fri, 3 Dec 2010 16:45:02 UTC
Severity: minor
Tags: fixed, patch
Found in version 24.0.50
Fixed in version 24.1
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Typing and evaluating the following code in the scratch
buffer results in an (appropriate) error, but with an incorrect
message:
(setq new-kmap (make-sparse-keymap))
(define-key new-kmap [?a 27] 'command)
(define-key new-kmap [?a ?\M-x] 'command)
;; Debugger entered--Lisp error:
;; (error "Key sequence a M-x starts with non-prefix key a")
;; (should be:
;; "Key sequence a M-x starts with non-prefix key a ESC")
The code in keymap.c loops over the characters in the key sequence and
says to report everything before the current character as the
non-prefix key. But that misses the case when M-x is converted into
[27 ?x] and it's the `27' part that causes the error.
Please see the attached patch.
A few other cases that show the problem:
(setq a (make-sparse-keymap))
(define-key a [27] 'command)
(define-key a [?\M-x] 'command)
;; Debugger entered--Lisp error:
;; (error "Key sequence M-x starts with non-prefix key ")
;; (should be:
;; "Key sequence M-x starts with non-prefix key ESC")
(setq new-kmap (make-sparse-keymap))
(define-key new-kmap [?a 27] 'command)
(define-key new-kmap [?a 27 ?x] 'command)
;; Debugger entered--Lisp error:
;; (error "Key sequence a M-x starts with non-prefix key a ESC")
;; (error text is correct)
(setq new-kmap (make-sparse-keymap))
(define-key new-kmap [?a] 'command)
(define-key new-kmap [?a ?\M-x] 'command)
;; Debugger entered--Lisp error:
;; (error "Key sequence a M-x starts with non-prefix key a")
;; (error text is correct)
In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
of 2010-12-03 on lappy
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
[define-key_diff (application/octet-stream, attachment)]
This bug report was last modified 14 years and 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.