1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

* lisp/subr.el (read-quoted-char): Use read-key.

(sit-for): Let read-event decode tty input.

Fixes: debbugs:14782
This commit is contained in:
Stefan Monnier 2013-07-05 20:10:54 -04:00
parent 47ba6d4383
commit 321e1a9c42
3 changed files with 27 additions and 24 deletions

View File

@ -1,8 +1,13 @@
2013-07-06 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (read-quoted-char): Use read-key.
(sit-for): Let read-event decode tty input (bug#14782).
2013-07-05 Stephen Berman <stephen.berman@gmx.net>
* 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 <michael.albinus@gmx.de>
* 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'.

View File

@ -1990,20 +1990,14 @@ for numeric input."
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 @@ any other non-digit terminates the character code and is then used as input."))
((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 @@ An obsolete, but still supported form is
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 @@ floating point support."
(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 @@ floating point support."
(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 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
(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))))

View File

@ -2286,7 +2286,6 @@ read_event_from_main_queue (EMACS_TIME *end_time,
XSETINT (c, XINT (c) | (extra_keyboard_modifiers & ~0xff7f & ~CHAR_CTL));
}
/* FIXME: Decode tty keyboard input here. */
return c;
}