GNU bug report logs - #6238
momentary-string-display => "(nil) is undefined"

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Fri, 21 May 2010 10:51:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6238 in the body.
You can then email your comments to 6238 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6238; Package emacs. (Fri, 21 May 2010 10:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 21 May 2010 10:51:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: momentary-string-display => "(nil) is undefined"
Date: Fri, 21 May 2010 12:24:54 +0200
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?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6238; Package emacs. (Sun, 30 May 2010 02:59:01 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: 6238 <at> debbugs.gnu.org
Subject: Re: bug#6238: momentary-string-display => "(nil) is undefined"
Date: Sun, 30 May 2010 04:58:30 +0200
ping?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6238; Package emacs. (Mon, 31 May 2010 14:16:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 6238 <at> debbugs.gnu.org
Subject: Re: bug#6238: momentary-string-display => "(nil) is undefined"
Date: Mon, 31 May 2010 10:15:06 -0400
Juanma Barranquero <lekktu <at> 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.




bug closed, send any further explanations to Juanma Barranquero <lekktu <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Mon, 31 May 2010 14:17:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 29 Jun 2010 11:24:04 GMT) Full text and rfc822 format available.

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.