emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

address@hidden: momentary-string-display input passing]


From: Richard Stallman
Subject: address@hidden: momentary-string-display input passing]
Date: Sat, 21 Feb 2004 09:56:24 -0500

This change looks basically reasonable to me, except I don't think
that an error is the right thing to do when the user types a function
key or clicks the mouse instead of typing the specified key.  I think
those should just be ignored, the way other input characters are
ignored.

Would someone like to make that change and install this?

------- Start of forwarded message -------
To: emacs-pretest-bug <address@hidden>
From: Matthew Mundell <address@hidden>
Date: 17 Feb 2004 23:15:12 +0000
Subject: momentary-string-display input passing
Sender: address@hidden

The CVS Elisp manual has the following example for
momentary-string-display.

(momentary-string-display
 "**** Important Message! ****"
 (point) ?\r
 "Type RET when done reading")

The idea seems to be that an Enter in response will only remove the
message.  However, evaluating the form (in the CVS Emacs) and pressing
Enter in response also results in the insertion of a newline.

The Enter key press is read with `read-event', which returns the
symbol `return', which is different from ?\r.

Perhaps the following change to momentary-string-display will be of
help.  It uses read-char when the parameter to be matched, EXIT-CHAR,
is a character.  It would need additions to handle mouse events.

===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/subr.el,v
retrieving revision 1.379
diff -c -r1.379 subr.el
*** subr.el     16 Feb 2004 19:40:07 -0000      1.379
- --- subr.el   17 Feb 2004 18:34:04 -0000
***************
*** 1455,1463 ****
                  (recenter 0))))
          (message (or message "Type %s to continue editing.")
                   (single-key-description exit-char))
!         (let ((char (read-event)))
!           (or (eq char exit-char)
!               (setq unread-command-events (list char)))))
        (if insert-end
          (save-excursion
            (delete-region pos insert-end)))
- --- 1455,1475 ----
                  (recenter 0))))
          (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 "Non-character input-event"
!                        ;; character type exit-char will differ from this event
!                        (setq unread-command-events (list char))))
!             ;; assume exit-char an event
!             (setq char (read-event))
!             (or (eq char exit-char)
!                 (eq char (event-convert-list exit-char))
!                 (setq unread-command-events (list char))))))
        (if insert-end
          (save-excursion
            (delete-region pos insert-end)))


_______________________________________________
Emacs-pretest-bug mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]