summaryrefslogtreecommitdiff
path: root/doc/lispref
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-03-22 10:29:16 +0100
committerMichael Albinus <michael.albinus@gmx.de>2022-03-22 10:29:16 +0100
commit0094dde11d97a0e69b053851a87f2934ef0e00aa (patch)
tree4db8bd0b777b68980b89b317f125e006dd88b267 /doc/lispref
parent7872d496d5dc272dacd2d2a5fd9238e39f2dbea8 (diff)
downloademacs-0094dde11d97a0e69b053851a87f2934ef0e00aa.tar.gz
emacs-0094dde11d97a0e69b053851a87f2934ef0e00aa.tar.bz2
emacs-0094dde11d97a0e69b053851a87f2934ef0e00aa.zip
Fix grep-like functions when running on a remote host
* doc/lispref/processes.texi (Shell Arguments): * etc/NEWS: Describe change in 'shell-quote-argument'. Fix typos. * lisp/subr.el (shell-quote-argument): New optional argument POSIX. * lisp/progmodes/grep.el (grep-compute-defaults) (grep-default-command, grep-expand-keywords, lgrep) (rgrep-default-command): Use POSIX argument in `shell-quote-argument'. (Bug#54487)
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/processes.texi11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index ed07c1cbf70..ea51abda4b7 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -197,7 +197,7 @@ gives special treatment to certain characters, and if these characters
occur in the file name, they will confuse the shell. To handle these
characters, use the function @code{shell-quote-argument}:
-@defun shell-quote-argument argument
+@defun shell-quote-argument argument &optional posix
This function returns a string that represents, in shell syntax,
an argument whose actual contents are @var{argument}. It should
work reliably to concatenate the return value into a shell command
@@ -227,6 +227,15 @@ a shell command:
" "
(shell-quote-argument newfile))
@end example
+
+If the optional @var{posix} argument is non-@code{nil}, @var{argument}
+is quoted according to POSIX shell quoting rules, regardless of the
+system’s shell. This is useful when your shell could run on a remote
+host, which requires a POSIX shell in general.
+
+@example
+(shell-quote-argument "foo > bar" (file-remote-p default-directory))
+@end example
@end defun
@cindex quoting and unquoting command-line arguments