From 38f4b8ea615025e7996754fd72449be91c38d448 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Jul 2016 18:03:09 +0300 Subject: Clarify the documentation of back-references in replacements * doc/emacs/search.texi (Regexp Replace): Clarify that \D starts with \1, not \0. * lisp/replace.el (query-replace-regexp) (query-replace-regexp-eval, replace-regexp): Doc fix (Bug#23884) --- doc/emacs/search.texi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index d841934c85..b41214df1a 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1356,12 +1356,12 @@ Replace every match for @var{regexp} with @var{newstring}. it can refer to all or part of what is matched by the @var{regexp}. @samp{\&} in @var{newstring} stands for the entire match being replaced. @samp{\@var{d}} in @var{newstring}, where @var{d} is a -digit, stands for whatever matched the @var{d}th parenthesized -grouping in @var{regexp}. (This is called a ``back reference''.) -@samp{\#} refers to the count of replacements already made in this -command, as a decimal number. In the first replacement, @samp{\#} -stands for @samp{0}; in the second, for @samp{1}; and so on. For -example, +digit starting from 1, stands for whatever matched the @var{d}th +parenthesized grouping in @var{regexp}. (This is called a ``back +reference''.) @samp{\#} refers to the count of replacements already +made in this command, as a decimal number. In the first replacement, +@samp{\#} stands for @samp{0}; in the second, for @samp{1}; and so on. +For example, @example M-x replace-regexp @key{RET} c[ad]+r @key{RET} \&-safe @key{RET} -- cgit v1.2.3 From dec756756070d271925c8c2a705de97eb8d7fb0b Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 1 Jul 2016 21:15:28 -0400 Subject: Explain when package-initialize isn't called * doc/lispref/os.texi (Startup Summary): Explain that package-initialize is not called when options -q, -Q, or --batch were passed (Bug #19151). --- doc/lispref/os.texi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 5f189b984a..ec14b014e5 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -155,9 +155,13 @@ It loads your abbrevs from the file specified by option @samp{--batch} was specified. @item -If @code{package-enable-at-startup} is non-@code{nil}, it calls the -function @code{package-initialize} to activate any optional Emacs Lisp -package that has been installed. @xref{Packaging Basics}. +It calls the function @code{package-initialize} to activate any +optional Emacs Lisp package that has been installed. @xref{Packaging +Basics}. However, Emacs doesn't initialize packages when +@code{package-enable-at-startup} is @code{nil} or when it's started +with one of the options @samp{-q}, @samp{-Q}, or @samp{--batch}. To +initialize packages in the latter case, @code{package-initialize} +should be called explicitly (e.g., via the @samp{--funcall} option). @vindex after-init-time @item -- cgit v1.2.3 From 178b2f590982e37991bc72b08a9e02b64d750601 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 3 Jul 2016 09:56:36 -0400 Subject: Note combine-and-quote-strings doesn't shell quote * doc/lispref/processes.texi (Shell Arguments): * lisp/subr.el (combine-and-quote-strings): Add a note that combine-and-quote-strings doesn't protect arguments against shell evaluation (Bug #20333). --- doc/lispref/processes.texi | 5 +++++ lisp/subr.el | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 5bd0b11cda..b4542f65cc 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -215,6 +215,11 @@ converting user input in the minibuffer, a Lisp string, into a list of string arguments to be passed to @code{call-process} or @code{start-process}, or for converting such lists of arguments into a single Lisp string to be presented in the minibuffer or echo area. +Note that if a shell is involved (e.g., if using +@code{call-process-shell-command}), arguments should still be +protected by @code{shell-quote-argument}; +@code{combine-and-quote-strings} is @emph{not} intended to protect +special characters from shell evaluation. @defun split-string-and-unquote string &optional separators This function splits @var{string} into substrings at matches for the diff --git a/lisp/subr.el b/lisp/subr.el index ed2166a0ee..e9e19d35f6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3706,7 +3706,10 @@ Modifies the match data; use `save-match-data' if necessary." "Concatenate the STRINGS, adding the SEPARATOR (default \" \"). This tries to quote the strings to avoid ambiguity such that (split-string-and-unquote (combine-and-quote-strings strs)) == strs -Only some SEPARATORs will work properly." +Only some SEPARATORs will work properly. + +Note that this is not intended to protect STRINGS from +interpretation by shells, use `shell-quote-argument' for that." (let* ((sep (or separator " ")) (re (concat "[\\\"]" "\\|" (regexp-quote sep)))) (mapconcat -- cgit v1.2.3