* bug#6238: momentary-string-display => "(nil) is undefined"
@ 2010-05-21 10:24 Juanma Barranquero
2010-05-30 2:58 ` Juanma Barranquero
0 siblings, 1 reply; 3+ messages in thread
From: Juanma Barranquero @ 2010-05-21 10:24 UTC (permalink / raw)
To: 6238
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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#6238: momentary-string-display => "(nil) is undefined"
2010-05-21 10:24 bug#6238: momentary-string-display => "(nil) is undefined" Juanma Barranquero
@ 2010-05-30 2:58 ` Juanma Barranquero
2010-05-31 14:15 ` Chong Yidong
0 siblings, 1 reply; 3+ messages in thread
From: Juanma Barranquero @ 2010-05-30 2:58 UTC (permalink / raw)
To: 6238
ping?
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#6238: momentary-string-display => "(nil) is undefined"
2010-05-30 2:58 ` Juanma Barranquero
@ 2010-05-31 14:15 ` Chong Yidong
0 siblings, 0 replies; 3+ messages in thread
From: Chong Yidong @ 2010-05-31 14:15 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: 6238
Juanma Barranquero <lekktu@gmail.com> writes:
> but the real question is, why all the hoopla around char vs. event?
> Why not just
I don't know why either; looks like cruft. I've checked your patch into
both branch and trunk, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-31 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 10:24 bug#6238: momentary-string-display => "(nil) is undefined" Juanma Barranquero
2010-05-30 2:58 ` Juanma Barranquero
2010-05-31 14:15 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.