emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113293: * lisp/subr.el (read-quoted-char): Use read


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r113293: * lisp/subr.el (read-quoted-char): Use read-key.
Date: Sat, 06 Jul 2013 00:11:03 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113293
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14782
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2013-07-05 20:10:54 -0400
message:
  * lisp/subr.el (read-quoted-char): Use read-key.
  (sit-for): Let read-event decode tty input.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-07-05 14:03:35 +0000
+++ b/lisp/ChangeLog    2013-07-06 00:10:54 +0000
@@ -1,8 +1,13 @@
+2013-07-06  Stefan Monnier  <address@hidden>
+
+       * subr.el (read-quoted-char): Use read-key.
+       (sit-for): Let read-event decode tty input (bug#14782).
+
 2013-07-05  Stephen Berman  <address@hidden>
 
        * calendar/todo-mode.el: Add handling of file deletion, both by
-       mode command and externally.  Fix various related bugs.  Clarify
-       Commentary and improve some documentation strings and code.
+       mode command and externally.  Fix various related bugs.
+       Clarify Commentary and improve some documentation strings and code.
        (todo-delete-file): New command.
        (todo-check-file): New function.
        (todo-show): Handle external deletion of the file we're trying to
@@ -20,8 +25,8 @@
        (todo-find-archive): Check whether there are any archives.
        Replace unnecessary setq by let-binding.
        (todo-archive-done-item): Use find-file-noselect to get the
-       archive buffer whether or not the archive already exists.  Remove
-       superfluous code.  Use file size instead of buffer-file-name to
+       archive buffer whether or not the archive already exists.
+       Remove superfluous code.  Use file size instead of buffer-file-name to
        check if the archive is new; if it is, update list of archives.
        (todo-default-todo-file): Allow nil to be a valid value for when
        there are no todo files.
@@ -38,9 +43,9 @@
 
 2013-07-05  Michael Albinus  <address@hidden>
 
-       * net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Support
-       both "gvfs-monitor-dir" and "inotifywait".
-       (tramp-sh-file-inotifywait-process-filter): Renamed from
+       * net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
+       Support both "gvfs-monitor-dir" and "inotifywait".
+       (tramp-sh-file-inotifywait-process-filter): Rename from
        `tramp-sh-file-notify-process-filter'.
        (tramp-sh-file-gvfs-monitor-dir-process-filter)
        (tramp-get-remote-gvfs-monitor-dir): New defuns.
@@ -69,8 +74,8 @@
 
        * subr.el (file-notify-handle-event): Move function to filenotify.el.
 
-       * net/tramp.el (tramp-file-name-for-operation): Handle
-       `file-notify-add-watch' and `file-notify-rm-watch'.
+       * net/tramp.el (tramp-file-name-for-operation):
+       Handle `file-notify-add-watch' and `file-notify-rm-watch'.
 
        * net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add handler
        for `file-notify-add-watch' and `file-notify-rm-watch'.

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2013-07-04 09:39:36 +0000
+++ b/lisp/subr.el      2013-07-06 00:10:54 +0000
@@ -1990,20 +1990,14 @@
 or the octal character code.
 RET terminates the character code and is discarded;
 any other non-digit terminates the character code and is then used as input."))
-       (setq char (read-event (and prompt (format "%s-" prompt)) t))
+       (setq translated (read-key (and prompt (format "%s-" prompt))))
        (if inhibit-quit (setq quit-flag nil)))
-      ;; Translate TAB key into control-I ASCII character, and so on.
-      ;; Note: `read-char' does it using the `ascii-character' property.
-      ;; We should try and use read-key instead.
-      (let ((translation (lookup-key local-function-key-map (vector char))))
-       (setq translated (if (arrayp translation)
-                            (aref translation 0)
-                          char)))
       (if (integerp translated)
          (setq translated (char-resolve-modifiers translated)))
       (cond ((null translated))
            ((not (integerp translated))
-            (setq unread-command-events (list char)
+            (setq unread-command-events
+                   (listify-key-sequence (this-single-command-raw-keys))
                   done t))
            ((/= (logand translated ?\M-\^@) 0)
             ;; Turn a meta-character into a character with the 0200 bit set.
@@ -2022,7 +2016,8 @@
            ((and (not first) (eq translated ?\C-m))
             (setq done t))
            ((not first)
-            (setq unread-command-events (list char)
+            (setq unread-command-events
+                   (listify-key-sequence (this-single-command-raw-keys))
                   done t))
            (t (setq code translated
                     done t)))
@@ -2186,6 +2181,7 @@
 where the optional arg MILLISECONDS specifies an additional wait period,
 in milliseconds; this was useful when Emacs was built without
 floating point support."
+  (declare (advertised-calling-convention (seconds &optional nodisp) "22.1"))
   (if (numberp nodisp)
       (setq seconds (+ seconds (* 1e-3 nodisp))
             nodisp obsolete)
@@ -2200,7 +2196,10 @@
     (or nodisp (redisplay)))
    (t
     (or nodisp (redisplay))
-    (let ((read (read-event nil nil seconds)))
+    ;; FIXME: we should not read-event here at all, because it's much too
+    ;; difficult to reliably "undo" a read-event by pushing it onto
+    ;; unread-command-events.
+    (let ((read (read-event nil t seconds)))
       (or (null read)
          (progn
            ;; If last command was a prefix arg, e.g. C-u, push this event onto
@@ -2210,7 +2209,6 @@
                (setq read (cons t read)))
            (push read unread-command-events)
            nil))))))
-(set-advertised-calling-convention 'sit-for '(seconds &optional nodisp) "22.1")
 
 (defun y-or-n-p (prompt)
   "Ask user a \"y or n\" question.  Return t if answer is \"y\".
@@ -2451,11 +2449,12 @@
                 (recenter (/ (window-height) 2))))
           (message (or message "Type %s to continue editing.")
                    (single-key-description exit-char))
-         (let ((event (read-event)))
+         (let ((event (read-key)))
            ;; `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)))))
+               (setq unread-command-events
+                      (append (this-single-command-raw-keys))))))
       (delete-overlay ol))))
 
 

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2013-06-11 04:15:49 +0000
+++ b/src/keyboard.c    2013-07-06 00:10:54 +0000
@@ -2286,7 +2286,6 @@
       XSETINT (c, XINT (c) | (extra_keyboard_modifiers & ~0xff7f & ~CHAR_CTL));
     }
 
-  /* FIXME: Decode tty keyboard input here.  */
   return c;
 }
 


reply via email to

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