aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-08-19 03:03:05 +0000
committerStefan Monnier2009-08-19 03:03:05 +0000
commit03a74b84f850e08f7d981d357ff03135b72f0d18 (patch)
tree980d4d2d97454f49efd59ab111d6d25eeeeba247
parente99652b05f7ec1ba5322a03b37cdb36aad74907d (diff)
downloademacs-03a74b84f850e08f7d981d357ff03135b72f0d18.tar.gz
emacs-03a74b84f850e08f7d981d357ff03135b72f0d18.zip
* subr.el (listify-key-sequence-1): Use normal syntax since those
integers are nowadays always represented by the same (positive) number on all platforms. (read-key-empty-map): New const. (read-key-delay): New var. (read-key): New function. (force-mode-line-update): Use with-current-buffer. (locate-user-emacs-file): Don't forget to abbreviate the file name. (start-process-shell-command, start-file-process-shell-command): Discourage the use of command-args. * processes.texi (Asynchronous Processes): Adjust arglist of start-process-shell-command and start-file-process-shell-command.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/processes.texi7
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/subr.el72
5 files changed, 83 insertions, 18 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index e07386d8b88..841f4d86c94 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12009-08-19 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * processes.texi (Asynchronous Processes): Adjust arglist of
4 start-process-shell-command and start-file-process-shell-command.
5
12009-08-15 Chong Yidong <cyd@stupidchicken.com> 62009-08-15 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * advice.texi (Argument Access in Advice): Note that argument 8 * advice.texi (Argument Access in Advice): Note that argument
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index b80b49f38cb..268cec388d0 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -581,11 +581,10 @@ example @code{ange-ftp-hook-function}). In such cases, the function
581does nothing and returns @code{nil}. 581does nothing and returns @code{nil}.
582@end defun 582@end defun
583 583
584@defun start-process-shell-command name buffer-or-name command &rest command-args 584@defun start-process-shell-command name buffer-or-name command
585This function is like @code{start-process} except that it uses a shell 585This function is like @code{start-process} except that it uses a shell
586to execute the specified command. The argument @var{command} is a shell 586to execute the specified command. The argument @var{command} is a shell
587command name, and @var{command-args} are the arguments for the shell 587command name. The variable @code{shell-file-name} specifies which shell to
588command. The variable @code{shell-file-name} specifies which shell to
589use. 588use.
590 589
591The point of running a program through the shell, rather than directly 590The point of running a program through the shell, rather than directly
@@ -597,7 +596,7 @@ characters do @emph{not} have their special shell meanings. @xref{Shell
597Arguments}. 596Arguments}.
598@end defun 597@end defun
599 598
600@defun start-file-process-shell-command name buffer-or-name command &rest command-args 599@defun start-file-process-shell-command name buffer-or-name command
601This function is like @code{start-process-shell-command}, but uses 600This function is like @code{start-process-shell-command}, but uses
602@code{start-file-process} internally. By this, @var{command} can be 601@code{start-file-process} internally. By this, @var{command} can be
603executed also on remote hosts, depending on @code{default-directory}. 602executed also on remote hosts, depending on @code{default-directory}.
diff --git a/etc/NEWS b/etc/NEWS
index ed2a33d22c6..b06fa3e17a4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -177,6 +177,10 @@ functions and variables.
177 177
178* Lisp changes in Emacs 23.2 178* Lisp changes in Emacs 23.2
179 179
180** read-key is a function halfway between read-event and read-key-sequence.
181It reads a single key, but obeys input and escape sequence decoding.
182** start-process-shell-command start-file-process-shell-command only
183take a single `command' argument any more.
180** Hash tables have a new printed representation that is readable. 184** Hash tables have a new printed representation that is readable.
181The feature `hashtable-print-readable' identifies this new 185The feature `hashtable-print-readable' identifies this new
182functionality. 186functionality.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 88e78198b6b..08c56531d96 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12009-08-19 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * subr.el (listify-key-sequence-1): Use normal syntax since those
4 integers are nowadays always represented by the same (positive) number
5 on all platforms.
6 (read-key-empty-map): New const.
7 (read-key-delay): New var.
8 (read-key): New function.
9 (force-mode-line-update): Use with-current-buffer.
10 (locate-user-emacs-file): Don't forget to abbreviate the file name.
11 (start-process-shell-command, start-file-process-shell-command):
12 Discourage the use of command-args.
13
12009-08-19 Glenn Morris <rgm@gnu.org> 142009-08-19 Glenn Morris <rgm@gnu.org>
2 15
3 * emacs-lisp/authors.el (authors-fixed-entries): Remove cvtmail. 16 * emacs-lisp/authors.el (authors-fixed-entries): Remove cvtmail.
diff --git a/lisp/subr.el b/lisp/subr.el
index 72c781ad490..668b323fbc0 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -225,7 +225,9 @@ This function accepts any number of arguments, but ignores them."
225 "Signal an error, making error message by passing all args to `format'. 225 "Signal an error, making error message by passing all args to `format'.
226In Emacs, the convention is that error messages start with a capital 226In Emacs, the convention is that error messages start with a capital
227letter but *do not* end with a period. Please follow this convention 227letter but *do not* end with a period. Please follow this convention
228for the sake of consistency." 228for the sake of consistency.
229
230\(fn STRING &rest ARGS)"
229 (while t 231 (while t
230 (signal 'error (list (apply 'format args))))) 232 (signal 'error (list (apply 'format args)))))
231 233
@@ -753,10 +755,7 @@ The normal global definition of the character C-x indirects to this keymap.")
753 755
754;;;; Event manipulation functions. 756;;;; Event manipulation functions.
755 757
756;; The call to `read' is to ensure that the value is computed at load time 758(defconst listify-key-sequence-1 (logior 128 ?\M-\C-@))
757;; and not compiled into the .elc file. The value is negative on most
758;; machines, but not on all!
759(defconst listify-key-sequence-1 (logior 128 (read "?\\M-\\^@")))
760 759
761(defun listify-key-sequence (key) 760(defun listify-key-sequence (key)
762 "Convert a key sequence to a list of events." 761 "Convert a key sequence to a list of events."
@@ -1759,6 +1758,48 @@ Legitimate radix values are 8, 10 and 16."
1759 :type '(choice (const 8) (const 10) (const 16)) 1758 :type '(choice (const 8) (const 10) (const 16))
1760 :group 'editing-basics) 1759 :group 'editing-basics)
1761 1760
1761(defconst read-key-empty-map (make-sparse-keymap))
1762
1763(defvar read-key-delay 0.1)
1764
1765(defun read-key (&optional prompt)
1766 "Read a key from the keyboard.
1767Contrary to `read-event' this will not return a raw event but instead will
1768obey the input decoding and translations usually done by `read-key-sequence'.
1769So escape sequences and keyboard encoding are taken into account.
1770When there's an ambiguity because the key looks like the prefix of
1771some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
1772 (let ((overriding-terminal-local-map read-key-empty-map)
1773 (overriding-local-map nil)
1774 (old-global-map (current-global-map))
1775 (timer (run-with-idle-timer
1776 ;; Wait long enough that Emacs has the time to receive and
1777 ;; process all the raw events associated with the single-key.
1778 ;; But don't wait too long, or the user may find the delay
1779 ;; annoying (or keep hitting more keys which may then get
1780 ;; lost or misinterpreted).
1781 ;; This is only relevant for keys which Emacs perceives as
1782 ;; "prefixes", such as C-x (because of the C-x 8 map in
1783 ;; key-translate-table and the C-x @ map in function-key-map)
1784 ;; or ESC (because of terminal escape sequences in
1785 ;; input-decode-map).
1786 read-key-delay t
1787 (lambda ()
1788 (let ((keys (this-command-keys-vector)))
1789 (unless (zerop (length keys))
1790 ;; `keys' is non-empty, so the user has hit at least
1791 ;; one key; there's no point waiting any longer, even
1792 ;; though read-key-sequence thinks we should wait
1793 ;; for more input to decide how to interpret the
1794 ;; current input.
1795 (throw 'read-key keys)))))))
1796 (unwind-protect
1797 (progn
1798 (use-global-map read-key-empty-map)
1799 (aref (catch 'read-key (read-key-sequence prompt nil t)) 0))
1800 (cancel-timer timer)
1801 (use-global-map old-global-map))))
1802
1762(defun read-quoted-char (&optional prompt) 1803(defun read-quoted-char (&optional prompt)
1763 "Like `read-char', but do not allow quitting. 1804 "Like `read-char', but do not allow quitting.
1764Also, if the first character read is an octal digit, 1805Also, if the first character read is an octal digit,
@@ -2095,7 +2136,7 @@ This finishes the change group by reverting all of its changes."
2095With optional non-nil ALL, force redisplay of all mode lines and 2136With optional non-nil ALL, force redisplay of all mode lines and
2096header lines. This function also forces recomputation of the 2137header lines. This function also forces recomputation of the
2097menu bar menus and the frame title." 2138menu bar menus and the frame title."
2098 (if all (save-excursion (set-buffer (other-buffer)))) 2139 (if all (with-current-buffer (other-buffer)))
2099 (set-buffer-modified-p (buffer-modified-p))) 2140 (set-buffer-modified-p (buffer-modified-p)))
2100 2141
2101(defun momentary-string-display (string pos &optional exit-char message) 2142(defun momentary-string-display (string pos &optional exit-char message)
@@ -2240,7 +2281,8 @@ directory if it does not exist."
2240 purify-flag 2281 purify-flag
2241 (file-accessible-directory-p (directory-file-name user-emacs-directory)) 2282 (file-accessible-directory-p (directory-file-name user-emacs-directory))
2242 (make-directory user-emacs-directory)) 2283 (make-directory user-emacs-directory))
2243 (expand-file-name new-name user-emacs-directory))))) 2284 (abbreviate-file-name
2285 (expand-file-name new-name user-emacs-directory))))))
2244 2286
2245 2287
2246;;;; Misc. useful functions. 2288;;;; Misc. useful functions.
@@ -2491,13 +2533,13 @@ BUFFER is the buffer (or buffer name) to associate with the process.
2491 an output stream or filter function to handle the output. 2533 an output stream or filter function to handle the output.
2492 BUFFER may be also nil, meaning that this process is not associated 2534 BUFFER may be also nil, meaning that this process is not associated
2493 with any buffer 2535 with any buffer
2494COMMAND is the name of a shell command. 2536COMMAND is the shell command to run.
2495Remaining arguments are the arguments for the command; they are all 2537
2496spliced together with blanks separating between each two of them, before 2538An old calling convention accepted any number of arguments after COMMAND,
2497passing the command to the shell. 2539which were just concatenated to COMMAND. This is still supported but strongly
2498Wildcards and redirection are handled as usual in the shell. 2540discouraged.
2499 2541
2500\(fn NAME BUFFER COMMAND &rest COMMAND-ARGS)" 2542\(fn NAME BUFFER COMMAND)"
2501 ;; We used to use `exec' to replace the shell with the command, 2543 ;; We used to use `exec' to replace the shell with the command,
2502 ;; but that failed to handle (...) and semicolon, etc. 2544 ;; but that failed to handle (...) and semicolon, etc.
2503 (start-process name buffer shell-file-name shell-command-switch 2545 (start-process name buffer shell-file-name shell-command-switch
@@ -2505,7 +2547,9 @@ Wildcards and redirection are handled as usual in the shell.
2505 2547
2506(defun start-file-process-shell-command (name buffer &rest args) 2548(defun start-file-process-shell-command (name buffer &rest args)
2507 "Start a program in a subprocess. Return the process object for it. 2549 "Start a program in a subprocess. Return the process object for it.
2508Similar to `start-process-shell-command', but calls `start-file-process'." 2550Similar to `start-process-shell-command', but calls `start-file-process'.
2551
2552\(fn NAME BUFFER COMMAND)"
2509 (start-file-process 2553 (start-file-process
2510 name buffer 2554 name buffer
2511 (if (file-remote-p default-directory) "/bin/sh" shell-file-name) 2555 (if (file-remote-p default-directory) "/bin/sh" shell-file-name)