diff options
| author | Paul Eggert | 2016-09-26 13:32:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-09-26 13:32:28 -0700 |
| commit | dcd90f60eb8952d119d97efcef9564ec96def054 (patch) | |
| tree | 2d3a5bbac64d7fbd94f3af0774218911a522e61f | |
| parent | c44ecb77ab33f0a0559c3e5da42fb486d6b014dd (diff) | |
| parent | 0ffc9cef49b0fceb3c5e904837ea5675fe4306ac (diff) | |
| download | emacs-dcd90f60eb8952d119d97efcef9564ec96def054.tar.gz emacs-dcd90f60eb8952d119d97efcef9564ec96def054.zip | |
Merge from origin/emacs-25
0ffc9ce Update admin/authors.el
0ad7410 Update Antinews in ELisp manual
ea0f750 Fix comments on window height macros
0bbdeed Fix 'url-http-create-request' when cookies are used
0045998 Fix cross reference in frames.texi
1392894 ; * etc/DEBUG: Minor copyedits.
304a5c8 ; * etc/DEBUG: Improve documentation of getting control to GDB.
56bf7d7 Fix regexp-opt documentation (bug #17862)
803ad6f ; Fix documentation of seq-subseq
ed4530d * lisp/emacs-lisp/gv.el (gv-ref): Fix example of PLACE in doc...
88ea396 ; Spelling fixes
17197d0 Fix tags-query-replace docstring
80a7f8b Clarify documentation of precision in format specs
88a5052 Improve and clarify documentation of subprocesses
89eb09f * etc/PROBLEMS: Mention gnutls-cli 3.5.3 (Bug#24247).
# Conflicts:
# etc/PROBLEMS
# src/process.c
| -rw-r--r-- | admin/authors.el | 2 | ||||
| -rw-r--r-- | doc/lispref/anti.texi | 162 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/frames.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/processes.texi | 649 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 52 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 5 | ||||
| -rw-r--r-- | etc/DEBUG | 75 | ||||
| -rw-r--r-- | etc/PROBLEMS | 19 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/gv.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/regexp-opt.el | 46 | ||||
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/etags.el | 2 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 7 | ||||
| -rw-r--r-- | src/process.c | 26 | ||||
| -rw-r--r-- | src/window.h | 4 |
17 files changed, 619 insertions, 445 deletions
diff --git a/admin/authors.el b/admin/authors.el index 3e9e005e222..198a8e4d260 100644 --- a/admin/authors.el +++ b/admin/authors.el | |||
| @@ -621,6 +621,8 @@ Changes to files in this list are not listed.") | |||
| 621 | ;; windowsnt.h to ms-w32.h. | 621 | ;; windowsnt.h to ms-w32.h. |
| 622 | ("Geoff Voelker" :wrote "w32-fns.el" "w32.c" "w32.h" "w32heap.c" | 622 | ("Geoff Voelker" :wrote "w32-fns.el" "w32.c" "w32.h" "w32heap.c" |
| 623 | "w32heap.h" "w32inevt.c" "w32proc.c" "w32term.c" "ms-w32.h") | 623 | "w32heap.h" "w32inevt.c" "w32proc.c" "w32term.c" "ms-w32.h") |
| 624 | ("Bob Weiner" :changed "dframe.el" "etags.c" "info.el" "quail.el" | ||
| 625 | "rmail.el" "rmailsum.el" "speedbar.el") | ||
| 624 | ("Morten Welinder" :wrote "dosfns.c" "[many MS-DOS files]" "msdos.h") | 626 | ("Morten Welinder" :wrote "dosfns.c" "[many MS-DOS files]" "msdos.h") |
| 625 | ("Eli Zaretskii" :wrote "bidi.c" "[bidirectional display in xdisp.c]" | 627 | ("Eli Zaretskii" :wrote "bidi.c" "[bidirectional display in xdisp.c]" |
| 626 | "[tty menus in term.c]") | 628 | "[tty menus in term.c]") |
diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi index 4b084014994..17d765de142 100644 --- a/doc/lispref/anti.texi +++ b/doc/lispref/anti.texi | |||
| @@ -6,132 +6,110 @@ | |||
| 6 | @c This node must have no pointers. | 6 | @c This node must have no pointers. |
| 7 | 7 | ||
| 8 | @node Antinews | 8 | @node Antinews |
| 9 | @appendix Emacs 23 Antinews | 9 | @appendix Emacs 24 Antinews |
| 10 | @c Update the elisp.texi Antinews menu entry with the above version number. | 10 | @c Update the elisp.texi Antinews menu entry with the above version number. |
| 11 | 11 | ||
| 12 | For those users who live backwards in time, here is information about | 12 | For those users who live backwards in time, here is information about |
| 13 | downgrading to Emacs version 23.4. We hope you will enjoy the greater | 13 | downgrading to Emacs version 24.5. We hope you will enjoy the greater |
| 14 | simplicity that results from the absence of many Emacs @value{EMACSVER} | 14 | simplicity that results from the absence of many Emacs @value{EMACSVER} |
| 15 | features. | 15 | features. |
| 16 | 16 | ||
| 17 | @section Old Lisp Features in Emacs 23 | 17 | @section Old Lisp Features in Emacs 24 |
| 18 | 18 | ||
| 19 | @itemize @bullet | 19 | @itemize @bullet |
| 20 | @item | 20 | @item |
| 21 | Support for lexical scoping has been removed; all variables are | 21 | The requirement that @code{setq} and @code{setf} must be called with |
| 22 | dynamically scoped. The @code{lexical-binding} variable has been | 22 | an even number of arguments has been removed. You can now call them |
| 23 | removed, and so has the @var{lexical} argument to @code{eval}. The | 23 | with an odd number of arguments, and Emacs will helpfully supply a |
| 24 | @code{defvar} and @code{defconst} forms no longer mark variables as | 24 | @code{nil} for the missing one. Simplicity rules! |
| 25 | dynamic, since all variables are dynamic. | ||
| 26 | |||
| 27 | Having only dynamic binding follows the spirit of Emacs extensibility, | ||
| 28 | for it allows any Emacs code to access any defined variable with a | ||
| 29 | minimum of fuss. But @xref{Dynamic Binding Tips}, for tips to avoid | ||
| 30 | making your programs hard to understand. | ||
| 31 | 25 | ||
| 32 | @item | 26 | @item |
| 33 | Calling a minor mode function from Lisp with a @code{nil} or omitted argument | 27 | @kbd{M-x shell} and @kbd{M-x compile} set the @env{EMACS} environment |
| 34 | does not enable the minor mode unconditionally; instead, it toggles | 28 | variable, as they should, to indicate that the subprocess is run by |
| 35 | the minor mode---which is the straightforward thing to do, since that | 29 | Emacs. This is so packages that took years to learn how to work |
| 36 | is the behavior when invoked interactively. One downside is that it | 30 | around that setting could continue using their code to that effect. |
| 37 | is more troublesome to enable minor modes from hooks; you have to do | ||
| 38 | something like | ||
| 39 | |||
| 40 | @example | ||
| 41 | (add-hook 'foo-hook (lambda () (bar-mode 1))) | ||
| 42 | @end example | ||
| 43 | |||
| 44 | @noindent | ||
| 45 | or define @code{turn-on-bar-mode} and call that from the hook. | ||
| 46 | 31 | ||
| 47 | @item | 32 | @item |
| 48 | The @code{prog-mode} dummy major mode has been removed. Instead of | 33 | The @code{save-excursion} form saves and restores the mark, as |
| 49 | using it as a crutch to meet programming mode conventions, you should | 34 | expected. No more need for the new @code{save-mark-and-excursion}, |
| 50 | explicitly ensure that your mode follows those conventions. | 35 | which has been deleted. |
| 51 | @xref{Major Mode Conventions}. | ||
| 52 | 36 | ||
| 53 | @item | 37 | @item |
| 54 | Emacs no longer supports bidirectional display and editing. Since | 38 | We have removed the @code{text-quoting-style} variable and the |
| 55 | there is no need to worry about the insertion of right-to-left text | 39 | associated functionality that translates quote characters in messages |
| 56 | messing up how lines and paragraphs are displayed, the function | 40 | displayed to the user and in help buffers. Emacs now shows exactly |
| 57 | @code{bidi-string-mark-left-to-right} has been removed; so have many | 41 | the same quote characters as you wrote in your code! Likewise, |
| 58 | other functions and variables related to bidirectional display. | 42 | @code{substitute-command-keys} leaves the quote characters alone. As |
| 59 | Unicode directionality characters like @code{U+200E} LEFT-TO-RIGHT | 43 | you move back in time, Unicode support becomes less and less |
| 60 | MARK have no special effect on display. | 44 | important, so no need to display those fancy new quotes the Unicode |
| 45 | Standard invented. | ||
| 61 | 46 | ||
| 62 | @item | 47 | @item |
| 63 | Emacs windows now have most of their internal state hidden from Lisp. | 48 | Regular expressions have been simplified by removing support for |
| 64 | Internal windows are no longer visible to Lisp; functions such as | 49 | Unicode character properties in regexp classes. As result, |
| 65 | @code{window-parent}, window parameters related to window arrangement, | 50 | @code{[:alpha:]} and @code{[:alnum:]} will match any character with a |
| 66 | and window-local buffer lists have all been removed. Functions for | 51 | word syntax, and @code{[:graph:]} and @code{[:print:]} will match any |
| 67 | resizing windows can delete windows if they become too small. | 52 | multibyte character, including surrogates and unassigned codepoints. |
| 68 | 53 | Once again, this is in line with diminishing importance of Unicode as | |
| 69 | The action-function feature for controlling buffer display has | 54 | you move back in time. |
| 70 | been removed, including @code{display-buffer-overriding-action} and | ||
| 71 | related variables, as well as the @var{action} argument to | ||
| 72 | @code{display-buffer} and other functions. The way to | ||
| 73 | programmatically control how Emacs chooses a window to display a | ||
| 74 | buffer is to bind the right combination of @code{pop-up-frames} and | ||
| 75 | other variables. | ||
| 76 | 55 | ||
| 77 | @item | 56 | @item |
| 78 | The standard completion interface has been simplified, eliminating the | 57 | Evaluating @samp{(/ @var{n})} will now yield @var{n}. We have |
| 79 | @code{completion-extra-properties} variable, the @code{metadata} | 58 | realized that interpreting that as in Common Lisp was a bad mistake |
| 80 | action flag for completion functions, and the concept of | 59 | that needed to be corrected. |
| 81 | completion categories. Lisp programmers may now find the choice | ||
| 82 | of methods for tuning completion less bewildering, but if a package | ||
| 83 | finds the streamlined interface insufficient for its needs, it must | ||
| 84 | implement its own specialized completion feature. | ||
| 85 | 60 | ||
| 86 | @item | 61 | @item |
| 87 | @code{copy-directory} now behaves the same whether or not the | 62 | The @code{pcase} form was significantly simplified by removing the |
| 88 | destination is an existing directory: if the destination exists, the | 63 | UPatterns @code{quote} and @code{app}. To further simplify this |
| 89 | @emph{contents} of the first directory are copied into it (with | 64 | facility, we've removed @code{pcase-defmacro}, since we found no need |
| 90 | subdirectories handled recursively), rather than copying the first | 65 | for letting Lisp programs define new UPatterns. |
| 91 | directory into a subdirectory. | ||
| 92 | 66 | ||
| 93 | @item | 67 | @item |
| 94 | The @var{trash} arguments for @code{delete-file} and | 68 | We've removed the text properties @code{cursor-intangible} and |
| 95 | @code{delete-directory} have been removed. The variable | 69 | @code{cursor-sensor-functions}, replacing them by the much simpler |
| 96 | @code{delete-by-moving-to-trash} must now be used with care; whenever | 70 | @code{intangible}, @code{point-entered}, and @code{point-left} |
| 97 | it is non-@code{nil}, all calls to @code{delete-file} or | 71 | properties. The latter are implemented on a much lower level, and |
| 98 | @code{delete-directory} use the trash. | 72 | therefore are better integrated with user expectations. For similar |
| 73 | reasons, @code{cursor-intangible-mode} and @code{cursor-sensor-mode} | ||
| 74 | were removed; use the hook variable @code{inhibit-point-motion-hooks} | ||
| 75 | which is no longer obsolete. | ||
| 99 | 76 | ||
| 100 | @item | 77 | @item |
| 101 | Because Emacs no longer supports SELinux file contexts, the | 78 | Process creation and management functions were significantly improved |
| 102 | @var{preserve-selinux-context} argument to @code{copy-file} has been | 79 | and simplified by removing @code{make-process} and the @code{pipe} |
| 103 | removed. The return value of @code{backup-buffer} no longer has an | 80 | connection type. Redirecting @code{stderr} of a subprocess should be |
| 104 | entry for the SELinux file context. | 81 | done with shell facilities, not by Emacs. |
| 105 | 82 | ||
| 106 | @item | 83 | @item |
| 107 | For mouse click input events in the text area, the Y pixel coordinate | 84 | We decided that shutting up informative messages is bad for user |
| 108 | in the @var{position} list (@pxref{Click Events}) now counts from the | 85 | interaction, so we've removed the @code{inhibit-message} variable |
| 109 | top of the header line, if there is one, rather than the top of the | 86 | which could be used to that effect. |
| 110 | text area. | ||
| 111 | 87 | ||
| 112 | @item | 88 | @item |
| 113 | Bindings in menu keymaps (@pxref{Format of Keymaps}) now sometimes get | 89 | Support for generators and for finalizers has been removed, as we |
| 114 | an additional @var{cache} entry in their definitions, like this: | 90 | found no real need for these facilities. |
| 115 | 91 | ||
| 116 | @example | 92 | @item |
| 117 | (@var{type} @var{item-name} @var{cache} . @var{binding}) | 93 | Due to excessive complexity and the diminishing need for Unicode |
| 118 | @end example | 94 | support, the functions @code{string-collate-lessp} and |
| 119 | 95 | @code{string-collate-equalp} were removed. Their locale-independent | |
| 120 | @noindent | 96 | counterparts @code{string-lessp} and @code{string-equal} are so much |
| 121 | The @var{cache} entry is used internally by Emacs to record equivalent | 97 | more simple and yield predictable results that we don't see any |
| 122 | keyboard key sequences for invoking the same command; Lisp programs | 98 | situation where the locale-dependent collation could be useful in |
| 123 | should never use it. | 99 | Emacs. As result, the @file{ls-lisp.el} package sorts files in a |
| 124 | @c Not really NEWS-worthy then... | 100 | locale-independent manner. |
| 125 | 101 | ||
| 126 | @item | 102 | @item |
| 127 | The @code{gnutls} library has been removed, and the function | 103 | In preparation for removal in some past version of Emacs of the |
| 128 | @code{open-network-stream} correspondingly simplified. | 104 | bidirectional editing support, we started by deleting two functions |
| 129 | Lisp programs that want an encrypted network connection must now call | 105 | @code{bidi-find-overridden-directionality} and |
| 130 | external utilities such as @command{starttls} or @command{gnutls-cli}. | 106 | @code{buffer-substring-with-bidi-context}. |
| 131 | 107 | ||
| 132 | @item | 108 | @item |
| 133 | Tool bars can no longer display separators, which frees up several | 109 | Time conversion functions, such as @code{current-time-string}, no |
| 134 | pixels of space on each graphical frame. | 110 | longer accept an optional @var{zone} argument. If you need to change |
| 111 | the current time zone (why?), do that explicitly with | ||
| 112 | @code{set-time-zone-rule}. | ||
| 135 | 113 | ||
| 136 | @item | 114 | @item |
| 137 | As part of the ongoing quest for simplicity, many other functions and | 115 | As part of the ongoing quest for simplicity, many other functions and |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index a3bff0b07ac..3297e5308ae 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -228,7 +228,7 @@ To view this manual in other formats, click | |||
| 228 | 228 | ||
| 229 | Appendices | 229 | Appendices |
| 230 | 230 | ||
| 231 | * Antinews:: Info for users downgrading to Emacs 23. | 231 | * Antinews:: Info for users downgrading to Emacs 24. |
| 232 | * GNU Free Documentation License:: The license for this documentation. | 232 | * GNU Free Documentation License:: The license for this documentation. |
| 233 | * GPL:: Conditions for copying and changing GNU Emacs. | 233 | * GPL:: Conditions for copying and changing GNU Emacs. |
| 234 | * Tips:: Advice and coding conventions for Emacs Lisp. | 234 | * Tips:: Advice and coding conventions for Emacs Lisp. |
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 53406d114af..7736438126c 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -1992,8 +1992,7 @@ Window Ordering}. | |||
| 1992 | 1992 | ||
| 1993 | Normally, each frame has its own minibuffer window at the bottom, which | 1993 | Normally, each frame has its own minibuffer window at the bottom, which |
| 1994 | is used whenever that frame is selected. If the frame has a minibuffer, | 1994 | is used whenever that frame is selected. If the frame has a minibuffer, |
| 1995 | you can get it with @code{minibuffer-window} (@pxref{Definition of | 1995 | you can get it with @code{minibuffer-window} (@pxref{Minibuffer Windows}). |
| 1996 | minibuffer-window}). | ||
| 1997 | 1996 | ||
| 1998 | @cindex frame without a minibuffer | 1997 | @cindex frame without a minibuffer |
| 1999 | @cindex surrogate minibuffer frame | 1998 | @cindex surrogate minibuffer frame |
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index e54cf301d4e..f9d5096dbea 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -27,9 +27,18 @@ with the subprocess or to control it. For example, you can send | |||
| 27 | signals, obtain status information, receive output from the process, or | 27 | signals, obtain status information, receive output from the process, or |
| 28 | send input to it. | 28 | send input to it. |
| 29 | 29 | ||
| 30 | In addition to processes that run programs, Lisp programs can open | ||
| 31 | connections of several types to devices or processes running on the | ||
| 32 | same machine or on other machines. The supported connection types | ||
| 33 | are: TCP and UDP network connections, serial port connections, and | ||
| 34 | pipe connections. Each such connection is also represented by a | ||
| 35 | process object. | ||
| 36 | |||
| 30 | @defun processp object | 37 | @defun processp object |
| 31 | This function returns @code{t} if @var{object} represents an Emacs | 38 | This function returns @code{t} if @var{object} represents an Emacs |
| 32 | subprocess, @code{nil} otherwise. | 39 | process object, @code{nil} otherwise. The process object can |
| 40 | represent a subprocess running a program or a connection of any | ||
| 41 | supported type. | ||
| 33 | @end defun | 42 | @end defun |
| 34 | 43 | ||
| 35 | In addition to subprocesses of the current Emacs session, you can | 44 | In addition to subprocesses of the current Emacs session, you can |
| @@ -67,7 +76,7 @@ Processes}. | |||
| 67 | @cindex process creation | 76 | @cindex process creation |
| 68 | 77 | ||
| 69 | There are three primitives that create a new subprocess in which to run | 78 | There are three primitives that create a new subprocess in which to run |
| 70 | a program. One of them, @code{start-process}, creates an asynchronous | 79 | a program. One of them, @code{make-process}, creates an asynchronous |
| 71 | process and returns a process object (@pxref{Asynchronous Processes}). | 80 | process and returns a process object (@pxref{Asynchronous Processes}). |
| 72 | The other two, @code{call-process} and @code{call-process-region}, | 81 | The other two, @code{call-process} and @code{call-process-region}, |
| 73 | create a synchronous process and do not return a process object | 82 | create a synchronous process and do not return a process object |
| @@ -82,15 +91,14 @@ fashion, their common arguments are described here. | |||
| 82 | @cindex execute program | 91 | @cindex execute program |
| 83 | @cindex @env{PATH} environment variable | 92 | @cindex @env{PATH} environment variable |
| 84 | @cindex @env{HOME} environment variable | 93 | @cindex @env{HOME} environment variable |
| 85 | In all cases, the function's @var{program} argument specifies the | 94 | In all cases, the functions specify the program to be run. An error |
| 86 | program to be run. An error is signaled if the file is not found or | 95 | is signaled if the file is not found or cannot be executed. If the |
| 87 | cannot be executed. If the file name is relative, the variable | 96 | file name is relative, the variable @code{exec-path} contains a list |
| 88 | @code{exec-path} contains a list of directories to search. Emacs | 97 | of directories to search. Emacs initializes @code{exec-path} when it |
| 89 | initializes @code{exec-path} when it starts up, based on the value of | 98 | starts up, based on the value of the environment variable @env{PATH}. |
| 90 | the environment variable @env{PATH}. The standard file name | 99 | The standard file name constructs, @samp{~}, @samp{.}, and @samp{..}, |
| 91 | constructs, @samp{~}, @samp{.}, and @samp{..}, are interpreted as | 100 | are interpreted as usual in @code{exec-path}, but environment variable |
| 92 | usual in @code{exec-path}, but environment variable substitutions | 101 | substitutions (@samp{$HOME}, etc.)@: are not recognized; use |
| 93 | (@samp{$HOME}, etc.)@: are not recognized; use | ||
| 94 | @code{substitute-in-file-name} to perform them (@pxref{File Name | 102 | @code{substitute-in-file-name} to perform them (@pxref{File Name |
| 95 | Expansion}). @code{nil} in this list refers to | 103 | Expansion}). @code{nil} in this list refers to |
| 96 | @code{default-directory}. | 104 | @code{default-directory}. |
| @@ -106,27 +114,36 @@ system-dependent. | |||
| 106 | @end defopt | 114 | @end defopt |
| 107 | 115 | ||
| 108 | @strong{Please note:} The argument @var{program} contains only the | 116 | @strong{Please note:} The argument @var{program} contains only the |
| 109 | name of the program; it may not contain any command-line arguments. You | 117 | name of the program file; it may not contain any command-line |
| 110 | must use a separate argument, @var{args}, to provide those, as | 118 | arguments. You must use a separate argument, @var{args}, to provide |
| 111 | described below. | 119 | those, as described below. |
| 112 | 120 | ||
| 113 | Each of the subprocess-creating functions has a @var{buffer-or-name} | 121 | Each of the subprocess-creating functions has a @var{buffer-or-name} |
| 114 | argument that specifies where the standard output from the program will | 122 | argument that specifies where the output from the program will go. It |
| 115 | go. It should be a buffer or a buffer name; if it is a buffer name, | 123 | should be a buffer or a buffer name; if it is a buffer name, that will |
| 116 | that will create the buffer if it does not already exist. It can also | 124 | create the buffer if it does not already exist. It can also be |
| 117 | be @code{nil}, which says to discard the output, unless a custom filter function | 125 | @code{nil}, which says to discard the output, unless a custom filter |
| 118 | handles it. (@xref{Filter Functions}, and @ref{Read and Print}.) | 126 | function handles it. (@xref{Filter Functions}, and @ref{Read and |
| 119 | Normally, you should avoid having multiple processes send output to the | 127 | Print}.) Normally, you should avoid having multiple processes send |
| 120 | same buffer because their output would be intermixed randomly. | 128 | output to the same buffer because their output would be intermixed |
| 121 | For synchronous processes, you can send the output to a file instead | 129 | randomly. For synchronous processes, you can send the output to a |
| 122 | of a buffer. | 130 | file instead of a buffer (and the corresponding argument is therefore |
| 131 | more appropriately called @var{destination}). By default, both | ||
| 132 | standard output and standard error streams go to the same destination, | ||
| 133 | but all the 3 primitives allow optionally to direct the standard error | ||
| 134 | stream to a different destination. | ||
| 123 | 135 | ||
| 124 | @cindex program arguments | 136 | @cindex program arguments |
| 125 | All three of the subprocess-creating functions have a @code{&rest} | 137 | All three of the subprocess-creating functions allow to specify |
| 126 | argument, @var{args}. The @var{args} must all be strings, and they are | 138 | command-line arguments for the process to run. For @code{call-process} |
| 127 | supplied to @var{program} as separate command line arguments. Wildcard | 139 | and @code{call-process-region}, these come in the form of a |
| 128 | characters and other shell constructs have no special meanings in these | 140 | @code{&rest} argument, @var{args}. For @code{make-process}, both the |
| 129 | strings, since the strings are passed directly to the specified program. | 141 | program to run and its command-line arguments are specified as a list |
| 142 | of strings. The command-line arguments must all be strings, and they | ||
| 143 | are supplied to the program as separate argument strings. Wildcard | ||
| 144 | characters and other shell constructs have no special meanings in | ||
| 145 | these strings, since the strings are passed directly to the specified | ||
| 146 | program. | ||
| 130 | 147 | ||
| 131 | @cindex environment variables, subprocesses | 148 | @cindex environment variables, subprocesses |
| 132 | The subprocess inherits its environment from Emacs, but you can | 149 | The subprocess inherits its environment from Emacs, but you can |
| @@ -147,6 +164,7 @@ The value of this variable is a list of directories to search for | |||
| 147 | programs to run in subprocesses. Each element is either the name of a | 164 | programs to run in subprocesses. Each element is either the name of a |
| 148 | directory (i.e., a string), or @code{nil}, which stands for the default | 165 | directory (i.e., a string), or @code{nil}, which stands for the default |
| 149 | directory (which is the value of @code{default-directory}). | 166 | directory (which is the value of @code{default-directory}). |
| 167 | @xref{Locating Files, executable-find}, for the details of this search. | ||
| 150 | @cindex program directories | 168 | @cindex program directories |
| 151 | 169 | ||
| 152 | The value of @code{exec-path} is used by @code{call-process} and | 170 | The value of @code{exec-path} is used by @code{call-process} and |
| @@ -210,11 +228,11 @@ a shell command: | |||
| 210 | The following two functions are useful for combining a list of | 228 | The following two functions are useful for combining a list of |
| 211 | individual command-line argument strings into a single string, and | 229 | individual command-line argument strings into a single string, and |
| 212 | taking a string apart into a list of individual command-line | 230 | taking a string apart into a list of individual command-line |
| 213 | arguments. These functions are mainly intended for | 231 | arguments. These functions are mainly intended for converting user |
| 214 | converting user input in the minibuffer, a Lisp string, into a list of | 232 | input in the minibuffer, a Lisp string, into a list of string |
| 215 | string arguments to be passed to @code{call-process} or | 233 | arguments to be passed to @code{make-process}, @code{call-process} or |
| 216 | @code{start-process}, or for converting such lists of arguments into | 234 | @code{start-process}, or for converting such lists of arguments into a |
| 217 | a single Lisp string to be presented in the minibuffer or echo area. | 235 | single Lisp string to be presented in the minibuffer or echo area. |
| 218 | Note that if a shell is involved (e.g., if using | 236 | Note that if a shell is involved (e.g., if using |
| 219 | @code{call-process-shell-command}), arguments should still be | 237 | @code{call-process-shell-command}), arguments should still be |
| 220 | protected by @code{shell-quote-argument}; | 238 | protected by @code{shell-quote-argument}; |
| @@ -331,7 +349,7 @@ string specifies a file name to redirect error output into. | |||
| 331 | You can't directly specify a buffer to put the error output in; that is | 349 | You can't directly specify a buffer to put the error output in; that is |
| 332 | too difficult to implement. But you can achieve this result by sending | 350 | too difficult to implement. But you can achieve this result by sending |
| 333 | the error output to a temporary file and then inserting the file into a | 351 | the error output to a temporary file and then inserting the file into a |
| 334 | buffer. | 352 | buffer when the subprocess finishes. |
| 335 | @end table | 353 | @end table |
| 336 | 354 | ||
| 337 | If @var{display} is non-@code{nil}, then @code{call-process} redisplays | 355 | If @var{display} is non-@code{nil}, then @code{call-process} redisplays |
| @@ -346,13 +364,15 @@ results become visible on the screen only when Emacs redisplays that | |||
| 346 | buffer in the normal course of events. | 364 | buffer in the normal course of events. |
| 347 | 365 | ||
| 348 | The remaining arguments, @var{args}, are strings that specify command | 366 | The remaining arguments, @var{args}, are strings that specify command |
| 349 | line arguments for the program. | 367 | line arguments for the program. Each string is passed to |
| 368 | @var{program} as a separate argument. | ||
| 350 | 369 | ||
| 351 | The value returned by @code{call-process} (unless you told it not to | 370 | The value returned by @code{call-process} (unless you told it not to |
| 352 | wait) indicates the reason for process termination. A number gives the | 371 | wait) indicates the reason for process termination. A number gives the |
| 353 | exit status of the subprocess; 0 means success, and any other value | 372 | exit status of the subprocess; 0 means success, and any other value |
| 354 | means failure. If the process terminated with a signal, | 373 | means failure. If the process terminated with a signal, |
| 355 | @code{call-process} returns a string describing the signal. | 374 | @code{call-process} returns a string describing the signal. If you |
| 375 | told @code{call-process} not to wait, it returns @code{nil}. | ||
| 356 | 376 | ||
| 357 | In the examples below, the buffer @samp{foo} is current. | 377 | In the examples below, the buffer @samp{foo} is current. |
| 358 | 378 | ||
| @@ -507,10 +527,10 @@ inputinput@point{} | |||
| 507 | 527 | ||
| 508 | @defun call-process-shell-command command &optional infile destination display | 528 | @defun call-process-shell-command command &optional infile destination display |
| 509 | This function executes the shell command @var{command} synchronously. | 529 | This function executes the shell command @var{command} synchronously. |
| 510 | The arguments are handled as in @code{call-process}. An old calling | 530 | The other arguments are handled as in @code{call-process}. An old |
| 511 | convention allowed passing any number of additional arguments after | 531 | calling convention allowed passing any number of additional arguments |
| 512 | @var{display}, which were concatenated to @var{command}; this is still | 532 | after @var{display}, which were concatenated to @var{command}; this is |
| 513 | supported, but strongly discouraged. | 533 | still supported, but strongly discouraged. |
| 514 | @end defun | 534 | @end defun |
| 515 | 535 | ||
| 516 | @defun process-file-shell-command command &optional infile destination display | 536 | @defun process-file-shell-command command &optional infile destination display |
| @@ -571,33 +591,169 @@ from the process only while waiting for input or for a time delay. | |||
| 571 | @cindex pipe | 591 | @cindex pipe |
| 572 | An asynchronous process is controlled either via a @dfn{pty} | 592 | An asynchronous process is controlled either via a @dfn{pty} |
| 573 | (pseudo-terminal) or a @dfn{pipe}. The choice of pty or pipe is made | 593 | (pseudo-terminal) or a @dfn{pipe}. The choice of pty or pipe is made |
| 574 | when creating the process, based on the value of the variable | 594 | when creating the process, by default based on the value of the |
| 575 | @code{process-connection-type} (see below). Ptys are usually | 595 | variable @code{process-connection-type} (see below). If available, |
| 576 | preferable for processes visible to the user, as in Shell mode, | 596 | ptys are usually preferable for processes visible to the user, as in |
| 577 | because they allow for job control (@kbd{C-c}, @kbd{C-z}, etc.)@: | 597 | Shell mode, because they allow for job control (@kbd{C-c}, @kbd{C-z}, |
| 578 | between the process and its children, whereas pipes do not. For | 598 | etc.)@: between the process and its children, and because interactive |
| 579 | subprocesses used for internal purposes by programs, it is often | 599 | programs treat ptys as terminal devices, whereas pipes don't support |
| 580 | better to use a pipe, because they are more efficient, and because | 600 | these features. However, for subprocesses used by Lisp programs for |
| 581 | they are immune to stray character injections that ptys introduce for | 601 | internal purposes, it is often better to use a pipe, because pipes are |
| 582 | large (around 500 byte) messages. Also, the total number of ptys is | 602 | more efficient, and because they are immune to stray character |
| 583 | limited on many systems and it is good not to waste them. | 603 | injections that ptys introduce for large (around 500 byte) messages. |
| 604 | Also, the total number of ptys is limited on many systems and it is | ||
| 605 | good not to waste them. | ||
| 606 | |||
| 607 | @defun make-process &rest args | ||
| 608 | This function is the basic low-level primitive for starting | ||
| 609 | asynchronous subprocesses. It returns a process object representing | ||
| 610 | the subprocess. Compared to the more high-level @code{start-process}, | ||
| 611 | described below, it takes keyword arguments, is more flexible, and | ||
| 612 | allows to specify process filters and sentinels in a single call. | ||
| 613 | |||
| 614 | The arguments @var{args} are a list of keyword/argument pairs. | ||
| 615 | Omitting a keyword is always equivalent to specifying it with value | ||
| 616 | @code{nil}. Here are the meaningful keywords: | ||
| 617 | |||
| 618 | @table @asis | ||
| 619 | @item :name @var{name} | ||
| 620 | Use the string @var{name} as the process name; if a process with this | ||
| 621 | name already exists, then @var{name} is modified (by appending | ||
| 622 | @samp{<1>}, etc.)@: to be unique. | ||
| 623 | |||
| 624 | @item :buffer @var{buffer} | ||
| 625 | Use @var{buffer} as the process buffer. If the value is @code{nil}, | ||
| 626 | the subprocess is not associated with any buffer. | ||
| 627 | |||
| 628 | @item :command @var{command} | ||
| 629 | Use @var{command} as the command line of the process. The value | ||
| 630 | should be a list starting with the program's executable file name, | ||
| 631 | followed by strings to give to the program as its arguments. If | ||
| 632 | the first element of the list is @code{nil}, Emacs opens a new | ||
| 633 | pseudoterminal (pty) and associates its input and output with | ||
| 634 | @var{buffer}, without actually running any program; the rest of the | ||
| 635 | list elements are ignored in that case. | ||
| 636 | |||
| 637 | @item :coding @var{coding} | ||
| 638 | If @var{coding} is a symbol, it specifies the coding system to be | ||
| 639 | used for both reading and writing of data from and to the | ||
| 640 | connection. If @var{coding} is a cons cell | ||
| 641 | @w{@code{(@var{decoding} . @var{encoding})}}, then @var{decoding} | ||
| 642 | will be used for reading and @var{encoding} for writing. The coding | ||
| 643 | system used for encoding the data written to the program is also used | ||
| 644 | for encoding the command-line arguments (but not the program itself, | ||
| 645 | whose file name is encoded as any other file name; @pxref{Encoding and | ||
| 646 | I/O, file-name-coding-system}). | ||
| 647 | |||
| 648 | If @var{coding} is @code{nil}, the default rules for finding the | ||
| 649 | coding system will apply. @xref{Default Coding Systems}. | ||
| 650 | |||
| 651 | @item :connection-type @var{TYPE} | ||
| 652 | Initialize the type of device used to communicate with the subprocess. | ||
| 653 | Possible values are @code{pty} to use a pty, @code{pipe} to use a | ||
| 654 | pipe, or @code{nil} to use the default derived from the value of the | ||
| 655 | @code{process-connection-type} variable. This parameter and the value | ||
| 656 | of @code{process-connection-type} are ignored if a non-@code{nil} | ||
| 657 | value is specified for the @code{:stderr} parameter; in that case, the | ||
| 658 | type will always be @code{pipe}. | ||
| 659 | |||
| 660 | @item :noquery @var{query-flag} | ||
| 661 | Initialize the process query flag to @var{query-flag}. | ||
| 662 | @xref{Query Before Exit}. | ||
| 663 | |||
| 664 | @item :stop @var{stopped} | ||
| 665 | If @var{stopped} is non-@code{nil}, start the process in the | ||
| 666 | stopped state. | ||
| 667 | |||
| 668 | @item :filter @var{filter} | ||
| 669 | Initialize the process filter to @var{filter}. If not specified, a | ||
| 670 | default filter will be provided, which can be overridden later. | ||
| 671 | @xref{Filter Functions}. | ||
| 672 | |||
| 673 | @item :sentinel @var{sentinel} | ||
| 674 | Initialize the process sentinel to @var{sentinel}. If not specified, | ||
| 675 | a default sentinel will be used, which can be overridden later. | ||
| 676 | @xref{Sentinels}. | ||
| 677 | |||
| 678 | @item :stderr @var{stderr} | ||
| 679 | Associate @var{stderr} with the standard error of the process. A | ||
| 680 | non-@code{nil} value should be either a buffer or a pipe process | ||
| 681 | created with @code{make-pipe-process}, described below. | ||
| 682 | @end table | ||
| 683 | |||
| 684 | The original argument list, modified with the actual connection | ||
| 685 | information, is available via the @code{process-contact} function. | ||
| 686 | @end defun | ||
| 687 | |||
| 688 | @defun make-pipe-process &rest args | ||
| 689 | This function creates a bidirectional pipe which can be attached to a | ||
| 690 | child process. This is useful with the @code{:stderr} keyword of | ||
| 691 | @code{make-process}. The function returns a process object. | ||
| 692 | |||
| 693 | The arguments @var{args} are a list of keyword/argument pairs. | ||
| 694 | Omitting a keyword is always equivalent to specifying it with value | ||
| 695 | @code{nil}. | ||
| 696 | |||
| 697 | Here are the meaningful keywords: | ||
| 698 | |||
| 699 | @table @asis | ||
| 700 | @item :name @var{name} | ||
| 701 | Use the string @var{name} as the process name. As with | ||
| 702 | @code{make-process}, it is modified if necessary to make it unique. | ||
| 703 | |||
| 704 | @item :buffer @var{buffer} | ||
| 705 | Use @var{buffer} as the process buffer. | ||
| 706 | |||
| 707 | @item :coding @var{coding} | ||
| 708 | If @var{coding} is a symbol, it specifies the coding system to be | ||
| 709 | used for both reading and writing of data from and to the | ||
| 710 | connection. If @var{coding} is a cons cell | ||
| 711 | @w{@code{(@var{decoding} . @var{encoding})}}, then @var{decoding} | ||
| 712 | will be used for reading and @var{encoding} for writing. | ||
| 713 | |||
| 714 | If @var{coding} is @code{nil}, the default rules for finding the | ||
| 715 | coding system will apply. @xref{Default Coding Systems}. | ||
| 716 | |||
| 717 | @item :noquery @var{query-flag} | ||
| 718 | Initialize the process query flag to @var{query-flag}. | ||
| 719 | @xref{Query Before Exit}. | ||
| 720 | |||
| 721 | @item :stop @var{stopped} | ||
| 722 | If @var{stopped} is non-@code{nil}, start the process in the | ||
| 723 | stopped state. | ||
| 724 | |||
| 725 | @item :filter @var{filter} | ||
| 726 | Initialize the process filter to @var{filter}. If not specified, a | ||
| 727 | default filter will be provided, which can be changed later. | ||
| 728 | @xref{Filter Functions}. | ||
| 729 | |||
| 730 | @item :sentinel @var{sentinel} | ||
| 731 | Initialize the process sentinel to @var{sentinel}. If not specified, | ||
| 732 | a default sentinel will be used, which can be changed later. | ||
| 733 | @xref{Sentinels}. | ||
| 734 | @end table | ||
| 735 | |||
| 736 | The original argument list, modified with the actual connection | ||
| 737 | information, is available via the @code{process-contact} function. | ||
| 738 | @end defun | ||
| 584 | 739 | ||
| 585 | @defun start-process name buffer-or-name program &rest args | 740 | @defun start-process name buffer-or-name program &rest args |
| 586 | This function creates a new asynchronous subprocess and starts the | 741 | This function is a higher-level wrapper around @code{make-process}, |
| 587 | program @var{program} running in it. It returns a process object that | 742 | exposing an interface that is similar to @code{call-process}. It |
| 588 | stands for the new subprocess in Lisp. The argument @var{name} | 743 | creates a new asynchronous subprocess and starts the specified |
| 589 | specifies the name for the process object; if a process with this name | 744 | @var{program} running in it. It returns a process object that stands |
| 590 | already exists, then @var{name} is modified (by appending @samp{<1>}, | 745 | for the new subprocess in Lisp. The argument @var{name} specifies the |
| 591 | etc.)@: to be unique. The buffer @var{buffer-or-name} is the buffer to | 746 | name for the process object; as with @code{make-process}, it is |
| 592 | associate with the process. | 747 | modified if necessary to make it unique. The buffer |
| 748 | @var{buffer-or-name} is the buffer to associate with the process. | ||
| 593 | 749 | ||
| 594 | If @var{program} is @code{nil}, Emacs opens a new pseudoterminal (pty) | 750 | If @var{program} is @code{nil}, Emacs opens a new pseudoterminal (pty) |
| 595 | and associates its input and output with @var{buffer-or-name}, without | 751 | and associates its input and output with @var{buffer-or-name}, without |
| 596 | creating a subprocess. In that case, the remaining arguments | 752 | creating a subprocess. In that case, the remaining arguments |
| 597 | @var{args} are ignored. | 753 | @var{args} are ignored. |
| 598 | 754 | ||
| 599 | The remaining arguments, @var{args}, are strings that specify command | 755 | The rest of @var{args} are strings that specify command line arguments |
| 600 | line arguments for the subprocess. | 756 | for the subprocess. |
| 601 | 757 | ||
| 602 | In the example below, the first process is started and runs (rather, | 758 | In the example below, the first process is started and runs (rather, |
| 603 | sleeps) for 100 seconds (the output buffer @samp{foo} is created | 759 | sleeps) for 100 seconds (the output buffer @samp{foo} is created |
| @@ -639,14 +795,14 @@ subprocess running @var{program} in it, and returns its process | |||
| 639 | object. | 795 | object. |
| 640 | 796 | ||
| 641 | The difference from @code{start-process} is that this function may | 797 | The difference from @code{start-process} is that this function may |
| 642 | invoked a file handler based on the value of @code{default-directory}. | 798 | invoke a file handler based on the value of @code{default-directory}. |
| 643 | This handler ought to run @var{program}, perhaps on the local host, | 799 | This handler ought to run @var{program}, perhaps on the local host, |
| 644 | perhaps on a remote host that corresponds to @code{default-directory}. | 800 | perhaps on a remote host that corresponds to @code{default-directory}. |
| 645 | In the latter case, the local part of @code{default-directory} becomes | 801 | In the latter case, the local part of @code{default-directory} becomes |
| 646 | the working directory of the process. | 802 | the working directory of the process. |
| 647 | 803 | ||
| 648 | This function does not try to invoke file name handlers for | 804 | This function does not try to invoke file name handlers for |
| 649 | @var{program} or for the @var{program-args}. | 805 | @var{program} or for the rest of @var{args}. |
| 650 | 806 | ||
| 651 | Depending on the implementation of the file handler, it might not be | 807 | Depending on the implementation of the file handler, it might not be |
| 652 | possible to apply @code{process-filter} or @code{process-sentinel} to | 808 | possible to apply @code{process-filter} or @code{process-sentinel} to |
| @@ -660,19 +816,20 @@ this function does nothing and returns @code{nil}. | |||
| 660 | @end defun | 816 | @end defun |
| 661 | 817 | ||
| 662 | @defun start-process-shell-command name buffer-or-name command | 818 | @defun start-process-shell-command name buffer-or-name command |
| 663 | This function is like @code{start-process}, except that it uses a shell | 819 | This function is like @code{start-process}, except that it uses a |
| 664 | to execute the specified command. The argument @var{command} is a shell | 820 | shell to execute the specified @var{command}. The argument |
| 665 | command name. The variable @code{shell-file-name} specifies which shell to | 821 | @var{command} is a shell command string. The variable |
| 666 | use. | 822 | @code{shell-file-name} specifies which shell to use. |
| 667 | 823 | ||
| 668 | The point of running a program through the shell, rather than directly | 824 | The point of running a program through the shell, rather than directly |
| 669 | with @code{start-process}, is so that you can employ shell features such | 825 | with @code{make-process} or @code{start-process}, is so that you can |
| 670 | as wildcards in the arguments. It follows that if you include any | 826 | employ shell features such as wildcards in the arguments. It follows |
| 671 | arbitrary user-specified arguments in the command, you should quote them | 827 | that if you include any arbitrary user-specified arguments in the |
| 672 | with @code{shell-quote-argument} first, so that any special shell | 828 | command, you should quote them with @code{shell-quote-argument} first, |
| 673 | characters do @emph{not} have their special shell meanings. @xref{Shell | 829 | so that any special shell characters do @emph{not} have their special |
| 674 | Arguments}. Of course, when executing commands based on user input | 830 | shell meanings. @xref{Shell Arguments}. Of course, when executing |
| 675 | you should also consider the security implications. | 831 | commands based on user input you should also consider the security |
| 832 | implications. | ||
| 676 | @end defun | 833 | @end defun |
| 677 | 834 | ||
| 678 | @defun start-file-process-shell-command name buffer-or-name command | 835 | @defun start-file-process-shell-command name buffer-or-name command |
| @@ -687,9 +844,14 @@ asynchronous subprocesses. If it is non-@code{nil}, then ptys are | |||
| 687 | used, when available. Otherwise, pipes are used. | 844 | used, when available. Otherwise, pipes are used. |
| 688 | 845 | ||
| 689 | The value of @code{process-connection-type} takes effect when | 846 | The value of @code{process-connection-type} takes effect when |
| 690 | @code{start-process} is called. So you can specify how to communicate | 847 | @code{make-process} or @code{start-process} is called. So you can |
| 691 | with one subprocess by binding the variable around the call to | 848 | specify how to communicate with one subprocess by binding the variable |
| 692 | @code{start-process}. | 849 | around the call to these functions. |
| 850 | |||
| 851 | Note that the value of this variable is ignored when | ||
| 852 | @code{make-process} is called with a non-@code{nil} value of the | ||
| 853 | @code{:stderr} parameter; in that case, Emacs will communicate with | ||
| 854 | the process using pipes. | ||
| 693 | 855 | ||
| 694 | @smallexample | 856 | @smallexample |
| 695 | @group | 857 | @group |
| @@ -703,117 +865,6 @@ use the function @code{process-tty-name} (@pxref{Process | |||
| 703 | Information}). | 865 | Information}). |
| 704 | @end defvar | 866 | @end defvar |
| 705 | 867 | ||
| 706 | @defun make-process &rest args | ||
| 707 | This function is like @code{start-process}, but takes keyword arguments. | ||
| 708 | |||
| 709 | The arguments @var{args} are a list of keyword/argument pairs. | ||
| 710 | Omitting a keyword is always equivalent to specifying it with value | ||
| 711 | @code{nil}. Here are the meaningful keywords: | ||
| 712 | |||
| 713 | @table @asis | ||
| 714 | @item :name @var{name} | ||
| 715 | Use the string @var{name} as the process name. It is modified if | ||
| 716 | necessary to make it unique. | ||
| 717 | |||
| 718 | @item :buffer @var{buffer} | ||
| 719 | Use @var{buffer} as the process buffer. | ||
| 720 | |||
| 721 | @item :command @var{command} | ||
| 722 | Use @var{command} as the command line of the process. @var{command} | ||
| 723 | is a list starting with the program's executable file name, followed | ||
| 724 | by strings to give to program as arguments. | ||
| 725 | |||
| 726 | @item :coding @var{coding} | ||
| 727 | If @var{coding} is a symbol, it specifies the coding system to be | ||
| 728 | used for both reading and writing of data from and to the | ||
| 729 | connection. If @var{coding} is a cons cell | ||
| 730 | @w{@code{(@var{decoding} . @var{encoding})}}, then @var{decoding} | ||
| 731 | will be used for reading and @var{encoding} for writing. | ||
| 732 | |||
| 733 | If @var{coding} is @code{nil}, the default rules for finding the | ||
| 734 | coding system will apply. @xref{Default Coding Systems}. | ||
| 735 | |||
| 736 | @item :connection-type @var{TYPE} | ||
| 737 | Initialize the type of device used to communicate with the subprocess. | ||
| 738 | Possible values are @code{pty} to use a pty, @code{pipe} to use a | ||
| 739 | pipe, or @code{nil} to use the default derived from the value of | ||
| 740 | the @code{process-connection-type} variable. | ||
| 741 | |||
| 742 | @item :noquery @var{query-flag} | ||
| 743 | Initialize the process query flag to @var{query-flag}. | ||
| 744 | @xref{Query Before Exit}. | ||
| 745 | |||
| 746 | @item :stop @var{stopped} | ||
| 747 | If @var{stopped} is non-@code{nil}, start the process in the | ||
| 748 | stopped state. | ||
| 749 | |||
| 750 | @item :filter @var{filter} | ||
| 751 | Initialize the process filter to @var{filter}. If not specified, a | ||
| 752 | default filter will be provided. @xref{Filter Functions}. | ||
| 753 | |||
| 754 | @item :sentinel @var{sentinel} | ||
| 755 | Initialize the process sentinel to @var{sentinel}. If not specified, | ||
| 756 | a default sentinel will be used. @xref{Sentinels}. | ||
| 757 | |||
| 758 | @item :stderr @var{stderr} | ||
| 759 | Associate @var{stderr} with the standard error of the process. | ||
| 760 | @var{stderr} is either a buffer or a pipe process created with | ||
| 761 | @code{make-pipe-process}. | ||
| 762 | @end table | ||
| 763 | |||
| 764 | The original argument list, modified with the actual connection | ||
| 765 | information, is available via the @code{process-contact} function. | ||
| 766 | @end defun | ||
| 767 | |||
| 768 | @defun make-pipe-process &rest args | ||
| 769 | This function creates a bidirectional pipe which can be attached to a | ||
| 770 | child process (currently only useful with the @code{:stderr} keyword | ||
| 771 | of @code{make-process}). | ||
| 772 | |||
| 773 | The arguments @var{args} are a list of keyword/argument pairs. | ||
| 774 | Omitting a keyword is always equivalent to specifying it with value | ||
| 775 | @code{nil}, except for @code{:coding}. | ||
| 776 | Here are the meaningful keywords: | ||
| 777 | |||
| 778 | @table @asis | ||
| 779 | @item :name @var{name} | ||
| 780 | Use the string @var{name} as the process name. It is modified if | ||
| 781 | necessary to make it unique. | ||
| 782 | |||
| 783 | @item :buffer @var{buffer} | ||
| 784 | Use @var{buffer} as the process buffer. | ||
| 785 | |||
| 786 | @item :coding @var{coding} | ||
| 787 | If @var{coding} is a symbol, it specifies the coding system to be | ||
| 788 | used for both reading and writing of data from and to the | ||
| 789 | connection. If @var{coding} is a cons cell | ||
| 790 | @w{@code{(@var{decoding} . @var{encoding})}}, then @var{decoding} | ||
| 791 | will be used for reading and @var{encoding} for writing. | ||
| 792 | |||
| 793 | If @var{coding} is @code{nil}, the default rules for finding the | ||
| 794 | coding system will apply. @xref{Default Coding Systems}. | ||
| 795 | |||
| 796 | @item :noquery @var{query-flag} | ||
| 797 | Initialize the process query flag to @var{query-flag}. | ||
| 798 | @xref{Query Before Exit}. | ||
| 799 | |||
| 800 | @item :stop @var{stopped} | ||
| 801 | If @var{stopped} is non-@code{nil}, start the process in the | ||
| 802 | stopped state. | ||
| 803 | |||
| 804 | @item :filter @var{filter} | ||
| 805 | Initialize the process filter to @var{filter}. If not specified, a | ||
| 806 | default filter will be provided. @xref{Filter Functions}. | ||
| 807 | |||
| 808 | @item :sentinel @var{sentinel} | ||
| 809 | Initialize the process sentinel to @var{sentinel}. If not specified, | ||
| 810 | a default sentinel will be used. @xref{Sentinels}. | ||
| 811 | @end table | ||
| 812 | |||
| 813 | The original argument list, modified with the actual connection | ||
| 814 | information, is available via the @code{process-contact} function. | ||
| 815 | @end defun | ||
| 816 | |||
| 817 | @node Deleting Processes | 868 | @node Deleting Processes |
| 818 | @section Deleting Processes | 869 | @section Deleting Processes |
| 819 | @cindex deleting processes | 870 | @cindex deleting processes |
| @@ -843,14 +894,19 @@ they exit. | |||
| 843 | 894 | ||
| 844 | @defun delete-process process | 895 | @defun delete-process process |
| 845 | This function deletes a process, killing it with a @code{SIGKILL} | 896 | This function deletes a process, killing it with a @code{SIGKILL} |
| 846 | signal. The argument may be a process, the name of a process, a | 897 | signal if the process was running a program. The argument may be a |
| 847 | buffer, or the name of a buffer. (A buffer or buffer-name stands for | 898 | process, the name of a process, a buffer, or the name of a buffer. (A |
| 848 | the process that @code{get-buffer-process} returns.) Calling | 899 | buffer or buffer-name stands for the process that |
| 849 | @code{delete-process} on a running process terminates it, updates the | 900 | @code{get-buffer-process} returns.) Calling @code{delete-process} on |
| 850 | process status, and runs the sentinel immediately. If the | 901 | a running process terminates it, updates the process status, and runs |
| 851 | process has already terminated, calling @code{delete-process} has no | 902 | the sentinel immediately. If the process has already terminated, |
| 852 | effect on its status, or on the running of its sentinel (which will | 903 | calling @code{delete-process} has no effect on its status, or on the |
| 853 | happen sooner or later). | 904 | running of its sentinel (which will happen sooner or later). |
| 905 | |||
| 906 | If the process object represents a network, serial, or pipe | ||
| 907 | connection, its status changes to @code{closed}; otherwise, it changes | ||
| 908 | to @code{signal}, unless the process already exited. @xref{Process | ||
| 909 | Information, process-status}. | ||
| 854 | 910 | ||
| 855 | @smallexample | 911 | @smallexample |
| 856 | @group | 912 | @group |
| @@ -892,7 +948,8 @@ This function returns a list of all processes that have not been deleted. | |||
| 892 | 948 | ||
| 893 | @defun get-process name | 949 | @defun get-process name |
| 894 | This function returns the process named @var{name} (a string), or | 950 | This function returns the process named @var{name} (a string), or |
| 895 | @code{nil} if there is none. | 951 | @code{nil} if there is none. The argument @var{name} can also be a |
| 952 | process object, in which case it is returned. | ||
| 896 | 953 | ||
| 897 | @smallexample | 954 | @smallexample |
| 898 | @group | 955 | @group |
| @@ -906,7 +963,9 @@ This function returns the process named @var{name} (a string), or | |||
| 906 | This function returns the command that was executed to start | 963 | This function returns the command that was executed to start |
| 907 | @var{process}. This is a list of strings, the first string being the | 964 | @var{process}. This is a list of strings, the first string being the |
| 908 | program executed and the rest of the strings being the arguments that | 965 | program executed and the rest of the strings being the arguments that |
| 909 | were given to the program. | 966 | were given to the program. For a network, serial, or pipe connection, |
| 967 | this is either @code{nil}, which means the process is running or | ||
| 968 | @code{t} (process is stopped). | ||
| 910 | 969 | ||
| 911 | @smallexample | 970 | @smallexample |
| 912 | @group | 971 | @group |
| @@ -917,18 +976,19 @@ were given to the program. | |||
| 917 | @end defun | 976 | @end defun |
| 918 | 977 | ||
| 919 | @defun process-contact process &optional key | 978 | @defun process-contact process &optional key |
| 920 | 979 | This function returns information about how a network, a serial, or a | |
| 921 | This function returns information about how a network or serial | 980 | pipe connection was set up. When @var{key} is @code{nil}, it returns |
| 922 | process was set up. When @var{key} is @code{nil}, it returns | 981 | @code{(@var{hostname} @var{service})} for a network connection, |
| 923 | @code{(@var{hostname} @var{service})} for a network process, and | 982 | @code{(@var{port} @var{speed})} for a serial connection, and @code{t} |
| 924 | @code{(@var{port} @var{speed})} for a serial process. | 983 | for a pipe connection. For an ordinary child process, this function |
| 925 | For an ordinary child process, this function always returns @code{t}. | 984 | always returns @code{t} when called with a @code{nil} @var{key}. |
| 926 | 985 | ||
| 927 | If @var{key} is @code{t}, the value is the complete status information | 986 | If @var{key} is @code{t}, the value is the complete status information |
| 928 | for the connection, server, or serial port; that is, the list of | 987 | for the connection, server, serial port, or pipe; that is, the list of |
| 929 | keywords and values specified in @code{make-network-process} or | 988 | keywords and values specified in @code{make-network-process}, |
| 930 | @code{make-serial-process}, except that some of the values represent | 989 | @code{make-serial-process}, or @code{make-pipe-process}, except that |
| 931 | the current status instead of what you specified. | 990 | some of the values represent the current status instead of what you |
| 991 | specified. | ||
| 932 | 992 | ||
| 933 | For a network process, the values include (see | 993 | For a network process, the values include (see |
| 934 | @code{make-network-process} for a complete list): | 994 | @code{make-network-process} for a complete list): |
| @@ -953,8 +1013,9 @@ this value is the actual port number. | |||
| 953 | @code{:local} and @code{:remote} are included even if they were not | 1013 | @code{:local} and @code{:remote} are included even if they were not |
| 954 | specified explicitly in @code{make-network-process}. | 1014 | specified explicitly in @code{make-network-process}. |
| 955 | 1015 | ||
| 956 | For a serial process, see @code{make-serial-process} and | 1016 | For a serial connection, see @code{make-serial-process} and |
| 957 | @code{serial-process-configure} for a list of keys. | 1017 | @code{serial-process-configure} for the list of keys. For a pipe |
| 1018 | connection, see @code{make-pipe-process} for the list of keys. | ||
| 958 | 1019 | ||
| 959 | If @var{key} is a keyword, the function returns the value corresponding | 1020 | If @var{key} is a keyword, the function returns the value corresponding |
| 960 | to that keyword. | 1021 | to that keyword. |
| @@ -962,10 +1023,12 @@ to that keyword. | |||
| 962 | 1023 | ||
| 963 | @defun process-id process | 1024 | @defun process-id process |
| 964 | This function returns the @acronym{PID} of @var{process}. This is an | 1025 | This function returns the @acronym{PID} of @var{process}. This is an |
| 965 | integer that distinguishes the process @var{process} from all other | 1026 | integral number that distinguishes the process @var{process} from all |
| 966 | processes running on the same computer at the current time. The | 1027 | other processes running on the same computer at the current time. The |
| 967 | @acronym{PID} of a process is chosen by the operating system kernel when the | 1028 | @acronym{PID} of a process is chosen by the operating system kernel |
| 968 | process is started and remains constant as long as the process exists. | 1029 | when the process is started and remains constant as long as the |
| 1030 | process exists. For network, serial, and pipe connections, this | ||
| 1031 | function returns @code{nil}. | ||
| 969 | @end defun | 1032 | @end defun |
| 970 | 1033 | ||
| 971 | @defun process-name process | 1034 | @defun process-name process |
| @@ -989,11 +1052,11 @@ for a process that has exited. | |||
| 989 | @item signal | 1052 | @item signal |
| 990 | for a process that has received a fatal signal. | 1053 | for a process that has received a fatal signal. |
| 991 | @item open | 1054 | @item open |
| 992 | for a network connection that is open. | 1055 | for a network, serial, or pipe connection that is open. |
| 993 | @item closed | 1056 | @item closed |
| 994 | for a network connection that is closed. Once a connection | 1057 | for a network, serial, or pipe connection that is closed. Once a |
| 995 | is closed, you cannot reopen it, though you might be able to open | 1058 | connection is closed, you cannot reopen it, though you might be able |
| 996 | a new connection to the same place. | 1059 | to open a new connection to the same place. |
| 997 | @item connect | 1060 | @item connect |
| 998 | for a non-blocking connection that is waiting to complete. | 1061 | for a non-blocking connection that is waiting to complete. |
| 999 | @item failed | 1062 | @item failed |
| @@ -1011,9 +1074,11 @@ if @var{process-name} is not the name of an existing process. | |||
| 1011 | @end group | 1074 | @end group |
| 1012 | @end smallexample | 1075 | @end smallexample |
| 1013 | 1076 | ||
| 1014 | For a network connection, @code{process-status} returns one of the symbols | 1077 | For a network, serial, or pipe connection, @code{process-status} |
| 1015 | @code{open} or @code{closed}. The latter means that the other side | 1078 | returns one of the symbols @code{open}, @code{stop}, or @code{closed}. |
| 1016 | closed the connection, or Emacs did @code{delete-process}. | 1079 | The latter means that the other side closed the connection, or Emacs |
| 1080 | did @code{delete-process}. The value @code{stop} means that | ||
| 1081 | @code{stop-process} was called on the connection. | ||
| 1017 | @end defun | 1082 | @end defun |
| 1018 | 1083 | ||
| 1019 | @defun process-live-p process | 1084 | @defun process-live-p process |
| @@ -1024,24 +1089,29 @@ process is considered alive if its status is @code{run}, @code{open}, | |||
| 1024 | 1089 | ||
| 1025 | @defun process-type process | 1090 | @defun process-type process |
| 1026 | This function returns the symbol @code{network} for a network | 1091 | This function returns the symbol @code{network} for a network |
| 1027 | connection or server, @code{serial} for a serial port connection, or | 1092 | connection or server, @code{serial} for a serial port connection, |
| 1028 | @code{real} for a real subprocess. | 1093 | @code{pipe} for a pipe connection, or @code{real} for a subprocess |
| 1094 | created for running a program. | ||
| 1029 | @end defun | 1095 | @end defun |
| 1030 | 1096 | ||
| 1031 | @defun process-exit-status process | 1097 | @defun process-exit-status process |
| 1032 | This function returns the exit status of @var{process} or the signal | 1098 | This function returns the exit status of @var{process} or the signal |
| 1033 | number that killed it. (Use the result of @code{process-status} to | 1099 | number that killed it. (Use the result of @code{process-status} to |
| 1034 | determine which of those it is.) If @var{process} has not yet | 1100 | determine which of those it is.) If @var{process} has not yet |
| 1035 | terminated, the value is 0. | 1101 | terminated, the value is 0. For network, serial, and pipe connections |
| 1102 | that are already closed, the value is either 0 or 256, depending on | ||
| 1103 | whether the connection was closed normally or abnormally. | ||
| 1036 | @end defun | 1104 | @end defun |
| 1037 | 1105 | ||
| 1038 | @defun process-tty-name process | 1106 | @defun process-tty-name process |
| 1039 | This function returns the terminal name that @var{process} is using for | 1107 | This function returns the terminal name that @var{process} is using for |
| 1040 | its communication with Emacs---or @code{nil} if it is using pipes | 1108 | its communication with Emacs---or @code{nil} if it is using pipes |
| 1041 | instead of a terminal (see @code{process-connection-type} in | 1109 | instead of a pty (see @code{process-connection-type} in |
| 1042 | @ref{Asynchronous Processes}). If @var{process} represents a program | 1110 | @ref{Asynchronous Processes}). If @var{process} represents a program |
| 1043 | running on a remote host, the terminal name used by that program on | 1111 | running on a remote host, the terminal name used by that program on |
| 1044 | the remote host is provided as process property @code{remote-tty}. | 1112 | the remote host is provided as process property @code{remote-tty}. If |
| 1113 | @var{process} represents a network, serial, or pipe connection, the | ||
| 1114 | value is @code{nil}. | ||
| 1045 | @end defun | 1115 | @end defun |
| 1046 | 1116 | ||
| 1047 | @defun process-coding-system process | 1117 | @defun process-coding-system process |
| @@ -1085,8 +1155,10 @@ This function sets the process plist of @var{process} to @var{plist}. | |||
| 1085 | 1155 | ||
| 1086 | Asynchronous subprocesses receive input when it is sent to them by | 1156 | Asynchronous subprocesses receive input when it is sent to them by |
| 1087 | Emacs, which is done with the functions in this section. You must | 1157 | Emacs, which is done with the functions in this section. You must |
| 1088 | specify the process to send input to, and the input data to send. The | 1158 | specify the process to send input to, and the input data to send. If |
| 1089 | data appears on the standard input of the subprocess. | 1159 | the subprocess runs a program, the data appears on the standard input |
| 1160 | of that program; for connections, the data is sent to the connected | ||
| 1161 | device or program. | ||
| 1090 | 1162 | ||
| 1091 | @c FIXME which? | 1163 | @c FIXME which? |
| 1092 | Some operating systems have limited space for buffered input in a | 1164 | Some operating systems have limited space for buffered input in a |
| @@ -1149,12 +1221,14 @@ The function returns @var{process}. | |||
| 1149 | @end defun | 1221 | @end defun |
| 1150 | 1222 | ||
| 1151 | @defun process-running-child-p &optional process | 1223 | @defun process-running-child-p &optional process |
| 1152 | This function will tell you whether a @var{process} has given control | 1224 | This function will tell you whether a @var{process}, which must not be |
| 1153 | of its terminal to its own child process. If this is true, the | 1225 | a connection but a real subprocess, has given control of its terminal |
| 1154 | function returns the numeric ID of the foreground process group of | 1226 | to a child process of its own. If this is true, the function returns |
| 1155 | @var{process}; it returns @code{nil} if Emacs can be certain that this | 1227 | the numeric ID of the foreground process group of @var{process}; it |
| 1156 | is not so. The value is @code{t} if Emacs cannot tell whether this is | 1228 | returns @code{nil} if Emacs can be certain that this is not so. The |
| 1157 | true. | 1229 | value is @code{t} if Emacs cannot tell whether this is true. This |
| 1230 | function signals an error if @var{process} is a network, serial, or | ||
| 1231 | pipe connection, or is the subprocess is not active. | ||
| 1158 | @end defun | 1232 | @end defun |
| 1159 | 1233 | ||
| 1160 | @node Signals to Processes | 1234 | @node Signals to Processes |
| @@ -1187,17 +1261,22 @@ user ``hung up the phone'', i.e., disconnected.) | |||
| 1187 | The argument @var{process} must be either a process, a process | 1261 | The argument @var{process} must be either a process, a process |
| 1188 | name, a buffer, a buffer name, or @code{nil}. A buffer or buffer name | 1262 | name, a buffer, a buffer name, or @code{nil}. A buffer or buffer name |
| 1189 | stands for a process through @code{get-buffer-process}. @code{nil} | 1263 | stands for a process through @code{get-buffer-process}. @code{nil} |
| 1190 | stands for the process associated with the current buffer. An error | 1264 | stands for the process associated with the current buffer. Except |
| 1191 | is signaled if @var{process} does not identify a process. | 1265 | with @code{stop-process} and @code{continue-process}, an error is |
| 1266 | signaled if @var{process} does not identify an active process, or if | ||
| 1267 | it represents a network, serial, or pipe connection. | ||
| 1192 | 1268 | ||
| 1193 | The argument @var{current-group} is a flag that makes a difference | 1269 | The argument @var{current-group} is a flag that makes a difference |
| 1194 | when you are running a job-control shell as an Emacs subprocess. If it | 1270 | when you are running a job-control shell as an Emacs subprocess. If it |
| 1195 | is non-@code{nil}, then the signal is sent to the current process-group | 1271 | is non-@code{nil}, then the signal is sent to the current process-group |
| 1196 | of the terminal that Emacs uses to communicate with the subprocess. If | 1272 | of the terminal that Emacs uses to communicate with the subprocess. If |
| 1197 | the process is a job-control shell, this means the shell's current | 1273 | the process is a job-control shell, this means the shell's current |
| 1198 | subjob. If it is @code{nil}, the signal is sent to the process group of | 1274 | subjob. If @var{current-group} is @code{nil}, the signal is |
| 1199 | the immediate subprocess of Emacs. If the subprocess is a job-control | 1275 | sent to the process group of the immediate subprocess of Emacs. If |
| 1200 | shell, this is the shell itself. | 1276 | the subprocess is a job-control shell, this is the shell itself. If |
| 1277 | @var{current-group} is @code{lambda}, the signal is sent to the | ||
| 1278 | process-group that owns the terminal, but only if it is not the shell | ||
| 1279 | itself. | ||
| 1201 | 1280 | ||
| 1202 | The flag @var{current-group} has no effect when a pipe is used to | 1281 | The flag @var{current-group} has no effect when a pipe is used to |
| 1203 | communicate with the subprocess, because the operating system does not | 1282 | communicate with the subprocess, because the operating system does not |
| @@ -1228,21 +1307,29 @@ Emacs. | |||
| 1228 | @end defun | 1307 | @end defun |
| 1229 | 1308 | ||
| 1230 | @defun stop-process &optional process current-group | 1309 | @defun stop-process &optional process current-group |
| 1231 | This function stops the process @var{process} by sending the | 1310 | This function stops the specified @var{process}. If it is a real |
| 1232 | signal @code{SIGTSTP}. Use @code{continue-process} to resume its | 1311 | subprocess running a program, it sends the signal @code{SIGTSTP} to |
| 1312 | that subprocess. If @var{process} represents a network, serial, or | ||
| 1313 | pipe connection, this function inhibits handling of the incoming data | ||
| 1314 | from the connection; for a network server, this means not accepting | ||
| 1315 | new connections. Use @code{continue-process} to resume normal | ||
| 1233 | execution. | 1316 | execution. |
| 1234 | 1317 | ||
| 1235 | Outside of Emacs, on systems with job control, the stop character | 1318 | Outside of Emacs, on systems with job control, the stop character |
| 1236 | (usually @kbd{C-z}) normally sends this signal. When | 1319 | (usually @kbd{C-z}) normally sends the @code{SIGTSTP} signal to a |
| 1237 | @var{current-group} is non-@code{nil}, you can think of this function as | 1320 | subprocess. When @var{current-group} is non-@code{nil}, you can think |
| 1238 | typing @kbd{C-z} on the terminal Emacs uses to communicate with the | 1321 | of this function as typing @kbd{C-z} on the terminal Emacs uses to |
| 1239 | subprocess. | 1322 | communicate with the subprocess. |
| 1240 | @end defun | 1323 | @end defun |
| 1241 | 1324 | ||
| 1242 | @defun continue-process &optional process current-group | 1325 | @defun continue-process &optional process current-group |
| 1243 | This function resumes execution of the process @var{process} by sending | 1326 | This function resumes execution of the process @var{process}. If it |
| 1244 | it the signal @code{SIGCONT}. This presumes that @var{process} was | 1327 | is a real subprocess running a program, it sends the signal |
| 1245 | stopped previously. | 1328 | @code{SIGCONT} to that subprocess; this presumes that @var{process} |
| 1329 | was stopped previously. If @var{process} represents a network, | ||
| 1330 | serial, or pipe connection, this function resumes handling of the | ||
| 1331 | incoming data from the connection. For serial connections, data that | ||
| 1332 | arrived during the time the process was stopped might be lost. | ||
| 1246 | @end defun | 1333 | @end defun |
| 1247 | 1334 | ||
| 1248 | @deffn Command signal-process process signal | 1335 | @deffn Command signal-process process signal |
| @@ -1260,12 +1347,28 @@ children of Emacs. @xref{System Processes}. | |||
| 1260 | @cindex process output | 1347 | @cindex process output |
| 1261 | @cindex output from processes | 1348 | @cindex output from processes |
| 1262 | 1349 | ||
| 1263 | The output that a subprocess writes to its standard output stream | 1350 | The output that an asynchronous subprocess writes to its standard |
| 1264 | is passed to a function called the @dfn{filter function}. The default | 1351 | output stream is passed to a function called the @dfn{filter |
| 1265 | filter function simply inserts the output into a buffer, which is | 1352 | function}. The default filter function simply inserts the output into |
| 1266 | called the associated buffer of the process (@pxref{Process | 1353 | a buffer, which is called the associated buffer of the process |
| 1267 | Buffers}). If the process has no buffer then the default filter | 1354 | (@pxref{Process Buffers}). If the process has no buffer then the |
| 1268 | discards the output. | 1355 | default filter discards the output. |
| 1356 | |||
| 1357 | If the subprocess writes to its standard error stream, by default | ||
| 1358 | the error output is also passed to the process filter function. If | ||
| 1359 | Emacs uses a pseudo-TTY (pty) for communication with the subprocess, | ||
| 1360 | then it is impossible to separate the standard output and standard | ||
| 1361 | error streams of the subprocess, because a pseudo-TTY has only one | ||
| 1362 | output channel. In that case, if you want to keep the output to those | ||
| 1363 | streams separate, you should redirect one of them to a file---for | ||
| 1364 | example, by using an appropriate shell command via | ||
| 1365 | @code{start-process-shell-command} or a similar function. | ||
| 1366 | |||
| 1367 | Alternatively, you could use the @code{:stderr} parameter with a | ||
| 1368 | non-@code{nil} value in a call to @code{make-process} | ||
| 1369 | (@pxref{Asynchronous Processes, make-process}) to make the destination | ||
| 1370 | of the error output separate from the standard output; in that case, | ||
| 1371 | Emacs will use pipes for communicating with the subprocess. | ||
| 1269 | 1372 | ||
| 1270 | When a subprocess terminates, Emacs reads any pending output, | 1373 | When a subprocess terminates, Emacs reads any pending output, |
| 1271 | then stops reading output from that subprocess. Therefore, if the | 1374 | then stops reading output from that subprocess. Therefore, if the |
| @@ -1292,13 +1395,6 @@ from such processes, thus allowing them to produce more output before | |||
| 1292 | Emacs tries to read it. | 1395 | Emacs tries to read it. |
| 1293 | @end defvar | 1396 | @end defvar |
| 1294 | 1397 | ||
| 1295 | It is impossible to separate the standard output and standard error | ||
| 1296 | streams of the subprocess, because Emacs normally spawns the subprocess | ||
| 1297 | inside a pseudo-TTY, and a pseudo-TTY has only one output channel. If | ||
| 1298 | you want to keep the output to those streams separate, you should | ||
| 1299 | redirect one of them to a file---for example, by using an appropriate | ||
| 1300 | shell command. | ||
| 1301 | |||
| 1302 | @menu | 1398 | @menu |
| 1303 | * Process Buffers:: By default, output is put in a buffer. | 1399 | * Process Buffers:: By default, output is put in a buffer. |
| 1304 | * Filter Functions:: Filter functions accept output from the process. | 1400 | * Filter Functions:: Filter functions accept output from the process. |
| @@ -1333,7 +1429,7 @@ Before Exit}). This confirmation is done by the function | |||
| 1333 | @code{kill-buffer-query-functions} (@pxref{Killing Buffers}). | 1429 | @code{kill-buffer-query-functions} (@pxref{Killing Buffers}). |
| 1334 | 1430 | ||
| 1335 | @defun process-buffer process | 1431 | @defun process-buffer process |
| 1336 | This function returns the associated buffer of the process | 1432 | This function returns the associated buffer of the specified |
| 1337 | @var{process}. | 1433 | @var{process}. |
| 1338 | 1434 | ||
| 1339 | @smallexample | 1435 | @smallexample |
| @@ -1455,6 +1551,11 @@ standard output from the associated process. @emph{All} output from | |||
| 1455 | that process is passed to the filter. The default filter simply | 1551 | that process is passed to the filter. The default filter simply |
| 1456 | outputs directly to the process buffer. | 1552 | outputs directly to the process buffer. |
| 1457 | 1553 | ||
| 1554 | By default, the error output from the process, if any, is also | ||
| 1555 | passed to the filter function, unless the destination for the standard | ||
| 1556 | error stream of the process was separated from the standard output | ||
| 1557 | when the process was created (@pxref{Output from Processes}). | ||
| 1558 | |||
| 1458 | The filter function can only be called when Emacs is waiting for | 1559 | The filter function can only be called when Emacs is waiting for |
| 1459 | something, because process output arrives only at such times. Emacs | 1560 | something, because process output arrives only at such times. Emacs |
| 1460 | waits when reading terminal input (see the function | 1561 | waits when reading terminal input (see the function |
| @@ -1478,8 +1579,8 @@ cases, the right way to do this is with the macro | |||
| 1478 | caught automatically, so that it doesn't stop the execution of whatever | 1579 | caught automatically, so that it doesn't stop the execution of whatever |
| 1479 | program was running when the filter function was started. However, if | 1580 | program was running when the filter function was started. However, if |
| 1480 | @code{debug-on-error} is non-@code{nil}, errors are not caught. | 1581 | @code{debug-on-error} is non-@code{nil}, errors are not caught. |
| 1481 | This makes it possible to use the Lisp debugger to debug the | 1582 | This makes it possible to use the Lisp debugger to debug filter |
| 1482 | filter function. @xref{Debugger}. | 1583 | functions. @xref{Debugger}. |
| 1483 | 1584 | ||
| 1484 | Many filter functions sometimes (or always) insert the output in the | 1585 | Many filter functions sometimes (or always) insert the output in the |
| 1485 | process's buffer, mimicking the actions of the default filter. | 1586 | process's buffer, mimicking the actions of the default filter. |
| @@ -1517,8 +1618,8 @@ text arrives, you could insert a line like the following just before the | |||
| 1517 | @end smallexample | 1618 | @end smallexample |
| 1518 | 1619 | ||
| 1519 | To force point to the end of the new output, no matter where it was | 1620 | To force point to the end of the new output, no matter where it was |
| 1520 | previously, eliminate the variable @code{moving} and call | 1621 | previously, eliminate the variable @code{moving} from the example and |
| 1521 | @code{goto-char} unconditionally. | 1622 | call @code{goto-char} unconditionally. |
| 1522 | 1623 | ||
| 1523 | @ignore | 1624 | @ignore |
| 1524 | In earlier Emacs versions, every filter function that did regular | 1625 | In earlier Emacs versions, every filter function that did regular |
| @@ -1841,10 +1942,11 @@ was not. | |||
| 1841 | @node Query Before Exit | 1942 | @node Query Before Exit |
| 1842 | @section Querying Before Exit | 1943 | @section Querying Before Exit |
| 1843 | 1944 | ||
| 1844 | When Emacs exits, it terminates all its subprocesses by sending them | 1945 | When Emacs exits, it terminates all its subprocesses. For |
| 1845 | the @code{SIGHUP} signal. Because subprocesses may be doing | 1946 | subprocesses that run a program, it sends them the @code{SIGHUP} |
| 1846 | valuable work, Emacs normally asks the user to confirm that it is ok | 1947 | signal; connections are simply closed. Because subprocesses may be |
| 1847 | to terminate them. Each process has a query flag, which, if | 1948 | doing valuable work, Emacs normally asks the user to confirm that it |
| 1949 | is ok to terminate them. Each process has a query flag, which, if | ||
| 1848 | non-@code{nil}, says that Emacs should ask for confirmation before | 1950 | non-@code{nil}, says that Emacs should ask for confirmation before |
| 1849 | exiting and thus killing that process. The default for the query flag | 1951 | exiting and thus killing that process. The default for the query flag |
| 1850 | is @code{t}, meaning @emph{do} query. | 1952 | is @code{t}, meaning @emph{do} query. |
| @@ -2138,13 +2240,14 @@ the @code{open-network-stream} function described below. | |||
| 2138 | To distinguish the different types of processes, the | 2240 | To distinguish the different types of processes, the |
| 2139 | @code{process-type} function returns the symbol @code{network} for a | 2241 | @code{process-type} function returns the symbol @code{network} for a |
| 2140 | network connection or server, @code{serial} for a serial port | 2242 | network connection or server, @code{serial} for a serial port |
| 2141 | connection, or @code{real} for a real subprocess. | 2243 | connection, @code{pipe} for a pipe connection, or @code{real} for a |
| 2244 | real subprocess. | ||
| 2142 | 2245 | ||
| 2143 | The @code{process-status} function returns @code{open}, | 2246 | The @code{process-status} function returns @code{open}, |
| 2144 | @code{closed}, @code{connect}, or @code{failed} for network | 2247 | @code{closed}, @code{connect}, @code{stop}, or @code{failed} for |
| 2145 | connections. For a network server, the status is always | 2248 | network connections. For a network server, the status is always |
| 2146 | @code{listen}. None of those values is possible for a real | 2249 | @code{listen}. Except for @code{stop}, none of those values is |
| 2147 | subprocess. @xref{Process Information}. | 2250 | possible for a real subprocess. @xref{Process Information}. |
| 2148 | 2251 | ||
| 2149 | You can stop and resume operation of a network process by calling | 2252 | You can stop and resume operation of a network process by calling |
| 2150 | @code{stop-process} and @code{continue-process}. For a server | 2253 | @code{stop-process} and @code{continue-process}. For a server |
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index a04e6938cef..f627c882fae 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -948,26 +948,42 @@ possible. A hand-tuned regular expression can sometimes be slightly | |||
| 948 | more efficient, but is almost never worth the effort.}. | 948 | more efficient, but is almost never worth the effort.}. |
| 949 | @c E.g., see http://debbugs.gnu.org/2816 | 949 | @c E.g., see http://debbugs.gnu.org/2816 |
| 950 | 950 | ||
| 951 | If the optional argument @var{paren} is non-@code{nil}, then the | 951 | The optional argument @var{paren} can be any of the following: |
| 952 | returned regular expression is always enclosed by at least one | 952 | |
| 953 | parentheses-grouping construct. If @var{paren} is @code{words}, then | 953 | a string |
| 954 | that construct is additionally surrounded by @samp{\<} and @samp{\>}; | 954 | the resulting regexp is preceded by @var{paren} and followed by |
| 955 | alternatively, if @var{paren} is @code{symbols}, then that construct | 955 | @samp{\)}, e.g. use @samp{"\\(?1:"} to produce an explicitly |
| 956 | is additionally surrounded by @samp{\_<} and @samp{\_>} | 956 | numbered group. |
| 957 | (@code{symbols} is often appropriate when matching | 957 | |
| 958 | programming-language keywords and the like). | 958 | @code{words} |
| 959 | 959 | the resulting regexp is surrounded by @samp{\<\(} and @samp{\)\>}. | |
| 960 | This simplified definition of @code{regexp-opt} produces a | 960 | |
| 961 | regular expression which is equivalent to the actual value | 961 | @code{symbols} |
| 962 | (but not as efficient): | 962 | the resulting regexp is surrounded by @samp{\_<\(} and @samp{\)\_>} |
| 963 | (this is often appropriate when maching programming-language | ||
| 964 | keywords and the like). | ||
| 965 | |||
| 966 | non-@code{nil} | ||
| 967 | the resulting regexp is surrounded by @samp{\(} and @samp{\)}. | ||
| 968 | |||
| 969 | @code{nil} | ||
| 970 | the resulting regexp is surrounded by @samp{\(?:} and @samp{\)}, | ||
| 971 | if it is necessary to ensure that a postfix operator appended to | ||
| 972 | it will apply to the whole expression. | ||
| 973 | |||
| 974 | The resulting regexp of @code{regexp-opt} is equivalent to but usually | ||
| 975 | more efficient than that of a simplified version: | ||
| 963 | 976 | ||
| 964 | @example | 977 | @example |
| 965 | (defun regexp-opt (strings &optional paren) | 978 | (defun simplified-regexp-opt (strings &optional paren) |
| 966 | (let ((open-paren (if paren "\\(" "")) | 979 | (let ((parens (cond ((stringp paren) (cons paren "\\)")) |
| 967 | (close-paren (if paren "\\)" ""))) | 980 | ((eq paren 'words) '("\\<\\(" . "\\)\\>")) |
| 968 | (concat open-paren | 981 | ((eq paren 'symbols) '("\\_<\\(" . "\\)\\_>")) |
| 969 | (mapconcat 'regexp-quote strings "\\|") | 982 | ((null paren) '("\\(?:" . "\\)")) |
| 970 | close-paren))) | 983 | (t '("\\(" . "\\)"))))) |
| 984 | (concat (car paren) | ||
| 985 | (mapconcat 'regexp-quote strings "\\|") | ||
| 986 | (cdr paren)))) | ||
| 971 | @end example | 987 | @end example |
| 972 | @end defun | 988 | @end defun |
| 973 | 989 | ||
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 0b9529460f3..c5a6cb264d8 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -1060,8 +1060,9 @@ precision specifies how many decimal places to show; if zero, the | |||
| 1060 | decimal-point itself is also omitted. For @samp{%s} and @samp{%S}, | 1060 | decimal-point itself is also omitted. For @samp{%s} and @samp{%S}, |
| 1061 | the precision truncates the string to the given width, so @samp{%.3s} | 1061 | the precision truncates the string to the given width, so @samp{%.3s} |
| 1062 | shows only the first three characters of the representation for | 1062 | shows only the first three characters of the representation for |
| 1063 | @var{object}. Precision has no effect for other specification | 1063 | @var{object}. For other specification characters, the effect of |
| 1064 | characters. | 1064 | precision is what the local library functions of the @code{printf} |
| 1065 | family produce. | ||
| 1065 | 1066 | ||
| 1066 | @node Case Conversion | 1067 | @node Case Conversion |
| 1067 | @section Case Conversion in Lisp | 1068 | @section Case Conversion in Lisp |
| @@ -190,24 +190,44 @@ kick in, provided that you run under GDB. | |||
| 190 | 190 | ||
| 191 | ** Getting control to the debugger | 191 | ** Getting control to the debugger |
| 192 | 192 | ||
| 193 | Setting a breakpoint in a strategic place, after loading Emacs into | ||
| 194 | the debugger, but before running it, is the most efficient way of | ||
| 195 | making sure control will be returned to the debugger when you need | ||
| 196 | that. | ||
| 197 | |||
| 193 | 'Fsignal' is a very useful place to put a breakpoint in. All Lisp | 198 | 'Fsignal' is a very useful place to put a breakpoint in. All Lisp |
| 194 | errors go through there. If you are only interested in errors that | 199 | errors go through there. If you are only interested in errors that |
| 195 | would fire the debugger, breaking at 'maybe_call_debugger' is useful. | 200 | would fire the Lisp debugger, breaking at 'maybe_call_debugger' is |
| 201 | useful. | ||
| 202 | |||
| 203 | Another technique for get control to the debugger is to put a | ||
| 204 | breakpoint in some rarely used function. One such convenient function | ||
| 205 | is Fredraw_display, which you can invoke at will interactively with | ||
| 206 | "M-x redraw-display RET". | ||
| 196 | 207 | ||
| 197 | It is useful, when debugging, to have a guaranteed way to return to | 208 | It is also useful to have a guaranteed way to return to the debugger |
| 198 | the debugger at any time. When using X, this is easy: type C-z at the | 209 | at any arbitrary time. When using X, this is easy: type C-z at the |
| 199 | window where Emacs is running under GDB, and it will stop Emacs just | 210 | window where you are interacting with GDB, and it will stop Emacs just |
| 200 | as it would stop any ordinary program. When Emacs is running in a | 211 | as it would stop any ordinary program. (This doesn't work if GDB was |
| 201 | terminal, things are not so easy. | 212 | attached to a running Emacs process; in that case, you will need to |
| 213 | type C-z to the shell window from which Emacs was started, or use the | ||
| 214 | "kill -TSTP" method described below.) | ||
| 215 | |||
| 216 | When Emacs is displaying on a text terminal, things are not so easy, | ||
| 217 | so we describe the various alternatives below (however, those of them | ||
| 218 | that use signals only work on Posix systems). | ||
| 202 | 219 | ||
| 203 | The src/.gdbinit file in the Emacs distribution arranges for SIGINT | 220 | The src/.gdbinit file in the Emacs distribution arranges for SIGINT |
| 204 | (C-g in Emacs) to be passed to Emacs and not give control back to GDB. | 221 | (C-g in Emacs on a text-mode frame) to be passed to Emacs and not give |
| 205 | On modern POSIX systems, you can override that with this command: | 222 | control back to GDB. On modern systems, you can override that with |
| 223 | this command: | ||
| 206 | 224 | ||
| 207 | handle SIGINT stop nopass | 225 | handle SIGINT stop nopass |
| 208 | 226 | ||
| 209 | After this 'handle' command, SIGINT will return control to GDB. If | 227 | After this 'handle' command, SIGINT will return control to GDB. If |
| 210 | you want the C-g to cause a QUIT within Emacs as well, omit the 'nopass'. | 228 | you want the C-g to cause a QUIT within Emacs as well, omit the 'nopass'. |
| 229 | See the GDB manual for more details about signal handling and the | ||
| 230 | 'handle' command. | ||
| 211 | 231 | ||
| 212 | A technique that can work when 'handle SIGINT' does not is to store | 232 | A technique that can work when 'handle SIGINT' does not is to store |
| 213 | the code for some character into the variable stop_character. Thus, | 233 | the code for some character into the variable stop_character. Thus, |
| @@ -216,26 +236,37 @@ the code for some character into the variable stop_character. Thus, | |||
| 216 | 236 | ||
| 217 | makes Control-] (decimal code 29) the stop character. | 237 | makes Control-] (decimal code 29) the stop character. |
| 218 | Typing Control-] will cause immediate stop. You cannot | 238 | Typing Control-] will cause immediate stop. You cannot |
| 219 | use the set command until the inferior process has been started. | 239 | use the set command until the inferior process has been started, so |
| 220 | Put a breakpoint early in 'main', or suspend the Emacs, | 240 | start Emacs with the 'start' command, to get an opportunity to do the |
| 221 | to get an opportunity to do the set command. | 241 | above 'set' command. |
| 222 | 242 | ||
| 223 | Another technique for get control to the debugger is to put a | 243 | On a Posix host, you can also send a signal using the 'kill' command |
| 224 | breakpoint in some rarely used function. One such convenient function | 244 | from a shell prompt, like this: |
| 225 | is Fredraw_display, which you can invoke at will interactively with | ||
| 226 | "M-x redraw-display RET". | ||
| 227 | 245 | ||
| 228 | When Emacs is running in a terminal, it is sometimes useful to use a separate | 246 | kill -TSTP Emacs-PID |
| 229 | terminal for the debug session. This can be done by starting Emacs as usual, | ||
| 230 | then attaching to it from gdb with the 'attach' command which is explained in | ||
| 231 | the node "Attach" of the GDB manual. | ||
| 232 | 247 | ||
| 233 | On MS-Windows, you can start Emacs in its own separate terminal by | 248 | where Emacs-PID is the process ID of Emacs being debugged. Other |
| 234 | setting the new-console option before running Emacs under GDB: | 249 | useful signals to send are SIGUSR1 and SIGUSR2; see "Error Debugging" |
| 250 | in the ELisp manual for how to use those. | ||
| 251 | |||
| 252 | When Emacs is displaying on a text terminal, it is useful to have a | ||
| 253 | separate terminal for the debug session. This can be done by starting | ||
| 254 | Emacs as usual, then attaching to it from gdb with the 'attach' | ||
| 255 | command which is explained in the node "Attach" of the GDB manual. | ||
| 256 | |||
| 257 | On MS-Windows, you can alternatively start Emacs from its own separate | ||
| 258 | console by setting the new-console option before running Emacs under | ||
| 259 | GDB: | ||
| 235 | 260 | ||
| 236 | (gdb) set new-console 1 | 261 | (gdb) set new-console 1 |
| 237 | (gdb) run | 262 | (gdb) run |
| 238 | 263 | ||
| 264 | If you do this, then typing C-c or C-BREAK into the console window | ||
| 265 | through which you interact with GDB will stop Emacs and return control | ||
| 266 | to the debugger, no matter if Emacs displays GUI or text-mode frames. | ||
| 267 | This is the only reliable alternative on MS-Windows to get control to | ||
| 268 | the debugger, besides setting breakpoints in advance. | ||
| 269 | |||
| 239 | ** Examining Lisp object values. | 270 | ** Examining Lisp object values. |
| 240 | 271 | ||
| 241 | When you have a live process to debug, and it has not encountered a | 272 | When you have a live process to debug, and it has not encountered a |
| @@ -848,7 +879,7 @@ directed to the xterm window you opened above. | |||
| 848 | Similar arrangement is possible on a character terminal by using the | 879 | Similar arrangement is possible on a character terminal by using the |
| 849 | 'screen' package. | 880 | 'screen' package. |
| 850 | 881 | ||
| 851 | On MS-Windows, you can start Emacs in its own separate terminal by | 882 | On MS-Windows, you can start Emacs in its own separate console by |
| 852 | setting the new-console option before running Emacs under GDB: | 883 | setting the new-console option before running Emacs under GDB: |
| 853 | 884 | ||
| 854 | (gdb) set new-console 1 | 885 | (gdb) set new-console 1 |
diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 11532832c38..2e1044f16ea 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS | |||
| @@ -578,6 +578,25 @@ you have a personal configuration file (normally ~/.aspell.conf), it | |||
| 578 | can cause this error. Remove that file, execute 'ispell-kill-ispell' | 578 | can cause this error. Remove that file, execute 'ispell-kill-ispell' |
| 579 | in Emacs, and then try spell-checking again. | 579 | in Emacs, and then try spell-checking again. |
| 580 | 580 | ||
| 581 | *** Emacs eats all file descriptors when using kqueue file notifications. | ||
| 582 | See <http://debbugs.gnu.org/22814>. | ||
| 583 | |||
| 584 | When you have a large number of buffers running auto-revert-mode, and | ||
| 585 | Emacs is configured to use the kqueue file notification library, it | ||
| 586 | uses an own file descriptor for every watched file. On systems with a | ||
| 587 | small limit of file descriptors allowed per process, like OS X, you | ||
| 588 | could run out of file descriptors. You won't be able to open new files. | ||
| 589 | |||
| 590 | auto-revert-use-notify is set to nil in global-auto-revert-mode, therefore. | ||
| 591 | |||
| 592 | *** TLS problems, e.g., Gnus hangs when fetching via imaps | ||
| 593 | http://debbugs.gnu.org/24247 | ||
| 594 | |||
| 595 | gnutls-cli 3.5.3 (2016-08-09) does not generate a "- Handshake was | ||
| 596 | completed" message that tls.el relies upon, causing affected Emacs | ||
| 597 | functions to hang. To work around the problem, use older or newer | ||
| 598 | versions of gnutls-cli, or use Emacs's built-in gnutls support. | ||
| 599 | |||
| 581 | * Runtime problems related to font handling | 600 | * Runtime problems related to font handling |
| 582 | 601 | ||
| 583 | ** Characters are displayed as empty boxes or with wrong font under X. | 602 | ** Characters are displayed as empty boxes or with wrong font under X. |
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index ccdae484fa6..7a2b3fe1563 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -905,7 +905,7 @@ styles." | |||
| 905 | '(propertize (format "%s %d" (calendar-month-name month) year) | 905 | '(propertize (format "%s %d" (calendar-month-name month) year) |
| 906 | 'font-lock-face 'calendar-month-header) | 906 | 'font-lock-face 'calendar-month-header) |
| 907 | "Default format for calendar month headings with the American date style. | 907 | "Default format for calendar month headings with the American date style. |
| 908 | Normally you should not customize this, but `calender-month-header'." | 908 | Normally you should not customize this, but `calendar-month-header'." |
| 909 | :group 'calendar | 909 | :group 'calendar |
| 910 | :risky t | 910 | :risky t |
| 911 | :type 'sexp | 911 | :type 'sexp |
| @@ -915,7 +915,7 @@ Normally you should not customize this, but `calender-month-header'." | |||
| 915 | '(propertize (format "%s %d" (calendar-month-name month) year) | 915 | '(propertize (format "%s %d" (calendar-month-name month) year) |
| 916 | 'font-lock-face 'calendar-month-header) | 916 | 'font-lock-face 'calendar-month-header) |
| 917 | "Default format for calendar month headings with the European date style. | 917 | "Default format for calendar month headings with the European date style. |
| 918 | Normally you should not customize this, but `calender-month-header'." | 918 | Normally you should not customize this, but `calendar-month-header'." |
| 919 | :group 'calendar | 919 | :group 'calendar |
| 920 | :risky t | 920 | :risky t |
| 921 | :type 'sexp | 921 | :type 'sexp |
| @@ -925,7 +925,7 @@ Normally you should not customize this, but `calender-month-header'." | |||
| 925 | '(propertize (format "%d %s" year (calendar-month-name month)) | 925 | '(propertize (format "%d %s" year (calendar-month-name month)) |
| 926 | 'font-lock-face 'calendar-month-header) | 926 | 'font-lock-face 'calendar-month-header) |
| 927 | "Default format for calendar month headings with the ISO date style. | 927 | "Default format for calendar month headings with the ISO date style. |
| 928 | Normally you should not customize this, but `calender-month-header'." | 928 | Normally you should not customize this, but `calendar-month-header'." |
| 929 | :group 'calendar | 929 | :group 'calendar |
| 930 | :risky t | 930 | :risky t |
| 931 | :type 'sexp | 931 | :type 'sexp |
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 93572e5e658..fa7ac64bf04 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el | |||
| @@ -536,7 +536,7 @@ This macro only makes sense when used in a place." | |||
| 536 | "Return a reference to PLACE. | 536 | "Return a reference to PLACE. |
| 537 | This is like the `&' operator of the C language. | 537 | This is like the `&' operator of the C language. |
| 538 | Note: this only works reliably with lexical binding mode, except for very | 538 | Note: this only works reliably with lexical binding mode, except for very |
| 539 | simple PLACEs such as (function-symbol \\='foo) which will also work in dynamic | 539 | simple PLACEs such as (symbol-function \\='foo) which will also work in dynamic |
| 540 | binding mode." | 540 | binding mode." |
| 541 | (let ((code | 541 | (let ((code |
| 542 | (gv-letplace (getter setter) place | 542 | (gv-letplace (getter setter) place |
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index cf6653046b5..ef752858a4c 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el | |||
| @@ -86,18 +86,44 @@ | |||
| 86 | ;;;###autoload | 86 | ;;;###autoload |
| 87 | (defun regexp-opt (strings &optional paren) | 87 | (defun regexp-opt (strings &optional paren) |
| 88 | "Return a regexp to match a string in the list STRINGS. | 88 | "Return a regexp to match a string in the list STRINGS. |
| 89 | Each string should be unique in STRINGS and should not contain any regexps, | 89 | Each string should be unique in STRINGS and should not contain |
| 90 | quoted or not. If optional PAREN is non-nil, ensure that the returned regexp | 90 | any regexps, quoted or not. Optional PAREN specifies how the |
| 91 | is enclosed by at least one regexp grouping construct. | 91 | returned regexp is surrounded by grouping constructs. |
| 92 | The returned regexp is typically more efficient than the equivalent regexp: | ||
| 93 | 92 | ||
| 94 | (let ((open (if PAREN \"\\\\(\" \"\")) (close (if PAREN \"\\\\)\" \"\"))) | 93 | The optional argument PAREN can be any of the following: |
| 95 | (concat open (mapconcat \\='regexp-quote STRINGS \"\\\\|\") close)) | ||
| 96 | 94 | ||
| 97 | If PAREN is `words', then the resulting regexp is additionally surrounded | 95 | a string |
| 98 | by \\=\\< and \\>. | 96 | the resulting regexp is preceded by PAREN and followed by |
| 99 | If PAREN is `symbols', then the resulting regexp is additionally surrounded | 97 | \\), e.g. use \"\\\\(?1:\" to produce an explicitly numbered |
| 100 | by \\=\\_< and \\_>." | 98 | group. |
| 99 | |||
| 100 | `words' | ||
| 101 | the resulting regexp is surrounded by \\=\\<\\( and \\)\\>. | ||
| 102 | |||
| 103 | `symbols' | ||
| 104 | the resulting regexp is surrounded by \\_<\\( and \\)\\_>. | ||
| 105 | |||
| 106 | non-nil | ||
| 107 | the resulting regexp is surrounded by \\( and \\). | ||
| 108 | |||
| 109 | nil | ||
| 110 | the resulting regexp is surrounded by \\(?: and \\), if it is | ||
| 111 | necessary to ensure that a postfix operator appended to it will | ||
| 112 | apply to the whole expression. | ||
| 113 | |||
| 114 | The resulting regexp is equivalent to but usually more efficient | ||
| 115 | than that of a simplified version: | ||
| 116 | |||
| 117 | (defun simplified-regexp-opt (strings &optional paren) | ||
| 118 | (let ((parens | ||
| 119 | (cond ((stringp paren) (cons paren \"\\\\)\")) | ||
| 120 | ((eq paren 'words) '(\"\\\\\\=<\\\\(\" . \"\\\\)\\\\>\")) | ||
| 121 | ((eq paren 'symbols) '(\"\\\\_<\\\\(\" . \"\\\\)\\\\_>\")) | ||
| 122 | ((null paren) '(\"\\\\(?:\" . \"\\\\)\")) | ||
| 123 | (t '(\"\\\\(\" . \"\\\\)\"))))) | ||
| 124 | (concat (car paren) | ||
| 125 | (mapconcat 'regexp-quote strings \"\\\\|\") | ||
| 126 | (cdr paren))))" | ||
| 101 | (save-match-data | 127 | (save-match-data |
| 102 | ;; Recurse on the sorted list. | 128 | ;; Recurse on the sorted list. |
| 103 | (let* ((max-lisp-eval-depth 10000) | 129 | (let* ((max-lisp-eval-depth 10000) |
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index e5004f8cdab..9859f28f8e8 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -137,7 +137,7 @@ the sequence, and its index within the sequence." | |||
| 137 | 137 | ||
| 138 | (cl-defgeneric seq-subseq (sequence start &optional end) | 138 | (cl-defgeneric seq-subseq (sequence start &optional end) |
| 139 | "Return the sequence of elements of SEQUENCE from START to END. | 139 | "Return the sequence of elements of SEQUENCE from START to END. |
| 140 | END is inclusive. | 140 | END is exclusive. |
| 141 | 141 | ||
| 142 | If END is omitted, it defaults to the length of the sequence. If | 142 | If END is omitted, it defaults to the length of the sequence. If |
| 143 | START or END is negative, it counts from the end. Signal an | 143 | START or END is negative, it counts from the end. Signal an |
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 890d55294cf..d37ab8a9817 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el | |||
| @@ -1880,8 +1880,6 @@ Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | |||
| 1880 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace | 1880 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace |
| 1881 | with the command \\[tags-loop-continue]. | 1881 | with the command \\[tags-loop-continue]. |
| 1882 | Fourth arg FILE-LIST-FORM non-nil means initialize the replacement loop. | 1882 | Fourth arg FILE-LIST-FORM non-nil means initialize the replacement loop. |
| 1883 | Fifth and sixth arguments START and END are accepted, for compatibility | ||
| 1884 | with `query-replace-regexp', and ignored. | ||
| 1885 | 1883 | ||
| 1886 | If FILE-LIST-FORM is non-nil, it is a form to evaluate to | 1884 | If FILE-LIST-FORM is non-nil, it is a form to evaluate to |
| 1887 | produce the list of files to search. | 1885 | produce the list of files to search. |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 927d0bb8d57..81bb9b4721e 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -366,9 +366,10 @@ The string is based on `url-privacy-level' and `url-user-agent'." | |||
| 366 | auth | 366 | auth |
| 367 | ;; Cookies | 367 | ;; Cookies |
| 368 | (when (url-use-cookies url-http-target-url) | 368 | (when (url-use-cookies url-http-target-url) |
| 369 | (url-cookie-generate-header-lines | 369 | (url-http--encode-string |
| 370 | host real-fname | 370 | (url-cookie-generate-header-lines |
| 371 | (equal "https" (url-type url-http-target-url)))) | 371 | host real-fname |
| 372 | (equal "https" (url-type url-http-target-url))))) | ||
| 372 | ;; If-modified-since | 373 | ;; If-modified-since |
| 373 | (if (and (not no-cache) | 374 | (if (and (not no-cache) |
| 374 | (member url-http-method '("GET" nil))) | 375 | (member url-http-method '("GET" nil))) |
diff --git a/src/process.c b/src/process.c index 29bf43e0f29..9a0ab00c505 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -980,7 +980,7 @@ If PROCESS has not yet exited or died, return 0. */) | |||
| 980 | DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, | 980 | DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, |
| 981 | doc: /* Return the process id of PROCESS. | 981 | doc: /* Return the process id of PROCESS. |
| 982 | This is the pid of the external process which PROCESS uses or talks to. | 982 | This is the pid of the external process which PROCESS uses or talks to. |
| 983 | For a network connection, this value is nil. */) | 983 | For a network, serial, and pipe connections, this value is nil. */) |
| 984 | (register Lisp_Object process) | 984 | (register Lisp_Object process) |
| 985 | { | 985 | { |
| 986 | pid_t pid; | 986 | pid_t pid; |
| @@ -1004,8 +1004,8 @@ DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0, | |||
| 1004 | doc: /* Return the command that was executed to start PROCESS. | 1004 | doc: /* Return the command that was executed to start PROCESS. |
| 1005 | This is a list of strings, the first string being the program executed | 1005 | This is a list of strings, the first string being the program executed |
| 1006 | and the rest of the strings being the arguments given to it. | 1006 | and the rest of the strings being the arguments given to it. |
| 1007 | For a network or serial process, this is nil (process is running) or t | 1007 | For a network or serial or pipe connection, this is nil (process is running) |
| 1008 | \(process is stopped). */) | 1008 | or t (process is stopped). */) |
| 1009 | (register Lisp_Object process) | 1009 | (register Lisp_Object process) |
| 1010 | { | 1010 | { |
| 1011 | CHECK_PROCESS (process); | 1011 | CHECK_PROCESS (process); |
| @@ -1237,13 +1237,13 @@ DEFUN ("process-query-on-exit-flag", | |||
| 1237 | DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, | 1237 | DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, |
| 1238 | 1, 2, 0, | 1238 | 1, 2, 0, |
| 1239 | doc: /* Return the contact info of PROCESS; t for a real child. | 1239 | doc: /* Return the contact info of PROCESS; t for a real child. |
| 1240 | For a network or serial connection, the value depends on the optional | 1240 | For a network or serial or pipe connection, the value depends on the |
| 1241 | KEY arg. If KEY is nil, value is a cons cell of the form (HOST | 1241 | optional KEY arg. If KEY is nil, value is a cons cell of the form |
| 1242 | SERVICE) for a network connection or (PORT SPEED) for a serial | 1242 | \(HOST SERVICE) for a network connection or (PORT SPEED) for a serial |
| 1243 | connection. If KEY is t, the complete contact information for the | 1243 | connection; it is t for a pipe connection. If KEY is t, the complete |
| 1244 | connection is returned, else the specific value for the keyword KEY is | 1244 | contact information for the connection is returned, else the specific |
| 1245 | returned. See `make-network-process' or `make-serial-process' for a | 1245 | value for the keyword KEY is returned. See `make-network-process', |
| 1246 | list of keywords. | 1246 | `make-serial-process', or `make pipe-process' for the list of keywords. |
| 1247 | If PROCESS is a non-blocking network process that hasn't been fully | 1247 | If PROCESS is a non-blocking network process that hasn't been fully |
| 1248 | set up yet, this function will block until socket setup has completed. */) | 1248 | set up yet, this function will block until socket setup has completed. */) |
| 1249 | (Lisp_Object process, Lisp_Object key) | 1249 | (Lisp_Object process, Lisp_Object key) |
| @@ -1316,7 +1316,7 @@ a socket connection. */) | |||
| 1316 | 1316 | ||
| 1317 | DEFUN ("process-type", Fprocess_type, Sprocess_type, 1, 1, 0, | 1317 | DEFUN ("process-type", Fprocess_type, Sprocess_type, 1, 1, 0, |
| 1318 | doc: /* Return the connection type of PROCESS. | 1318 | doc: /* Return the connection type of PROCESS. |
| 1319 | The value is either the symbol `real', `network', or `serial'. | 1319 | The value is either the symbol `real', `network', `serial', or `pipe'. |
| 1320 | PROCESS may be a process, a buffer, the name of a process or buffer, or | 1320 | PROCESS may be a process, a buffer, the name of a process or buffer, or |
| 1321 | nil, indicating the current buffer's process. */) | 1321 | nil, indicating the current buffer's process. */) |
| 1322 | (Lisp_Object process) | 1322 | (Lisp_Object process) |
| @@ -6532,8 +6532,8 @@ See function `interrupt-process' for more details on usage. */) | |||
| 6532 | DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0, | 6532 | DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0, |
| 6533 | doc: /* Stop process PROCESS. May be process or name of one. | 6533 | doc: /* Stop process PROCESS. May be process or name of one. |
| 6534 | See function `interrupt-process' for more details on usage. | 6534 | See function `interrupt-process' for more details on usage. |
| 6535 | If PROCESS is a network or serial process, inhibit handling of incoming | 6535 | If PROCESS is a network or serial or pipe connection, inhibit handling |
| 6536 | traffic. */) | 6536 | of incoming traffic. */) |
| 6537 | (Lisp_Object process, Lisp_Object current_group) | 6537 | (Lisp_Object process, Lisp_Object current_group) |
| 6538 | { | 6538 | { |
| 6539 | if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process) | 6539 | if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process) |
diff --git a/src/window.h b/src/window.h index c2898194854..a124b3311d0 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -920,7 +920,7 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 920 | ? WINDOW_CONFIG_SCROLL_BAR_HEIGHT (W) \ | 920 | ? WINDOW_CONFIG_SCROLL_BAR_HEIGHT (W) \ |
| 921 | : 0) | 921 | : 0) |
| 922 | 922 | ||
| 923 | /* Height in pixels, and in lines, of the mode line. | 923 | /* Height in pixels of the mode line. |
| 924 | May be zero if W doesn't have a mode line. */ | 924 | May be zero if W doesn't have a mode line. */ |
| 925 | #define WINDOW_MODE_LINE_HEIGHT(W) \ | 925 | #define WINDOW_MODE_LINE_HEIGHT(W) \ |
| 926 | (WINDOW_WANTS_MODELINE_P ((W)) \ | 926 | (WINDOW_WANTS_MODELINE_P ((W)) \ |
| @@ -930,7 +930,7 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 930 | #define WINDOW_MODE_LINE_LINES(W) \ | 930 | #define WINDOW_MODE_LINE_LINES(W) \ |
| 931 | WINDOW_WANTS_MODELINE_P (W) | 931 | WINDOW_WANTS_MODELINE_P (W) |
| 932 | 932 | ||
| 933 | /* Height in pixels, and in lines, of the header line. | 933 | /* Height in pixels of the header line. |
| 934 | Zero if W doesn't have a header line. */ | 934 | Zero if W doesn't have a header line. */ |
| 935 | #define WINDOW_HEADER_LINE_HEIGHT(W) \ | 935 | #define WINDOW_HEADER_LINE_HEIGHT(W) \ |
| 936 | (WINDOW_WANTS_HEADER_LINE_P (W) \ | 936 | (WINDOW_WANTS_HEADER_LINE_P (W) \ |