GNU bug report logs -
#6238
momentary-string-display => "(nil) is undefined"
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
emacs -Q
M-: (momentary-string-display "xxx" (point)) <RET>
<right> ; or any non-char event
=> "(nil) is undefined"
The reason is this code:
(let (char)
(if (integerp exit-char)
(condition-case nil
(progn
(setq char (read-char))
(or (eq char exit-char)
(setq unread-command-events (list char))))
(error
;; `exit-char' is a character, hence it differs
;; from char, which is an event.
(setq unread-command-events (list char))))
...
but, whenever wer're inside the condition-case, any error (which can
only happen in read-char) will make char = nil, so the error handler
will set `unread-command-events' to (nil).
It's easy to fix like this:
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2010-05-18 20:31:44 +0000
+++ lisp/subr.el 2010-05-21 09:59:28 +0000
@@ -2207,13 +2207,8 @@
(let (char)
(if (integerp exit-char)
- (condition-case nil
- (progn
- (setq char (read-char))
- (or (eq char exit-char)
- (setq unread-command-events (list char))))
- (error
- ;; `exit-char' is a character, hence it differs
- ;; from char, which is an event.
- (setq unread-command-events (list char))))
+ (ignore-errors
+ (setq char (read-char))
+ (or (eq char exit-char)
+ (setq unread-command-events (list char))))
;; `exit-char' can be an event, or an event description list.
(setq char (read-event))
but the real question is, why all the hoopla around char vs. event? Why not just
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2010-05-18 20:31:44 +0000
+++ lisp/subr.el 2010-05-21 10:19:56 +0000
@@ -2205,20 +2205,9 @@
(message (or message "Type %s to continue editing.")
(single-key-description exit-char))
- (let (char)
- (if (integerp exit-char)
- (condition-case nil
- (progn
- (setq char (read-char))
- (or (eq char exit-char)
- (setq unread-command-events (list char))))
- (error
- ;; `exit-char' is a character, hence it differs
- ;; from char, which is an event.
- (setq unread-command-events (list char))))
- ;; `exit-char' can be an event, or an event description list.
- (setq char (read-event))
- (or (eq char exit-char)
- (eq char (event-convert-list exit-char))
- (setq unread-command-events (list char))))))
+ (let ((event (read-event)))
+ ;; `exit-char' can be an event, or an event description list.
+ (or (eq event exit-char)
+ (eq event (event-convert-list exit-char))
+ (setq unread-command-events (list event)))))
(delete-overlay ol))))
which seems to work for chars, events and event description lists?
This bug report was last modified 14 years and 360 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.