From: Lars Ingebrigtsen Date: Thu, 15 Jul 2021 08:29:04 +0000 (+0200) Subject: Rename shell-split-string to split-string-shell-command X-Git-Tag: emacs-28.0.90~1863 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=28e7b5104141225f997c82c168a5e60a80caaf3e;p=emacs.git Rename shell-split-string to split-string-shell-command * lisp/shell.el (split-string-shell-command): * doc/lispref/processes.texi (Shell Arguments): Rename from shell-split-string. --- diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index c8e9f0cea6e..90c42156372 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -247,12 +247,12 @@ protected by @code{shell-quote-argument}; @code{combine-and-quote-strings} is @emph{not} intended to protect special characters from shell evaluation. -@defun shell-split-string string +@defun split-string-shell-command string This function splits @var{string} into substrings, respecting double and single quotes, as well as backslash quoting. @smallexample -(shell-split-string "ls /tmp/'foo bar'") +(split-string-shell-command "ls /tmp/'foo bar'") @result{} ("ls" "/tmp/foo bar") @end smallexample @end defun diff --git a/etc/NEWS b/etc/NEWS index 29c2d9db73f..7388a0f6251 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2971,7 +2971,7 @@ The former is now declared obsolete. * Lisp Changes in Emacs 28.1 +++ -*** New function 'shell-split-string'. +*** New function 'split-string-shell-command'. This splits a shell string into separate components, respecting single and double quotes, as well as backslash quoting. diff --git a/lisp/shell.el b/lisp/shell.el index 15783bb9246..5444b5837c2 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -459,7 +459,7 @@ Useful for shells like zsh that has this feature." (push (mapconcat #'identity (nreverse arg) "") args))) (cons (nreverse args) (nreverse begins))))) -(defun shell-split-string (string) +(defun split-string-shell-command (string) "Split STRING (a shell command) into a list of strings. General shell syntax, like single and double quoting, as well as backslash quoting, is respected." diff --git a/test/lisp/shell-tests.el b/test/lisp/shell-tests.el index ad54644e556..1e5de71ad79 100644 --- a/test/lisp/shell-tests.el +++ b/test/lisp/shell-tests.el @@ -46,17 +46,17 @@ '(("cd" "ba" "") 1 4 7))))) (ert-deftest shell-tests-split-string () - (should (equal (shell-split-string "ls /tmp") + (should (equal (split-string-shell-command "ls /tmp") '("ls" "/tmp"))) - (should (equal (shell-split-string "ls '/tmp/foo bar'") + (should (equal (split-string-shell-command "ls '/tmp/foo bar'") '("ls" "/tmp/foo bar"))) - (should (equal (shell-split-string "ls \"/tmp/foo bar\"") + (should (equal (split-string-shell-command "ls \"/tmp/foo bar\"") '("ls" "/tmp/foo bar"))) - (should (equal (shell-split-string "ls /tmp/'foo bar'") + (should (equal (split-string-shell-command "ls /tmp/'foo bar'") '("ls" "/tmp/foo bar"))) - (should (equal (shell-split-string "ls /tmp/'foo\\ bar'") + (should (equal (split-string-shell-command "ls /tmp/'foo\\ bar'") '("ls" "/tmp/foo\\ bar"))) - (should (equal (shell-split-string "ls /tmp/foo\\ bar") + (should (equal (split-string-shell-command "ls /tmp/foo\\ bar") '("ls" "/tmp/foo bar")))) ;;; shell-tests.el ends here