From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: bug#1212: 23.0.60; split-string-and-unquote problems Date: Tue, 21 Oct 2008 00:53:30 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1224545795 29193 80.91.229.12 (20 Oct 2008 23:36:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Oct 2008 23:36:35 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, 1212@emacsbugs.donarmstrong.com, emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 21 01:37:34 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ks3e8-0006Qg-Tj for ged-emacs-devel@m.gmane.org; Tue, 21 Oct 2008 00:54:45 +0200 Original-Received: from localhost ([127.0.0.1]:57579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ks3d3-0001MU-KT for ged-emacs-devel@m.gmane.org; Mon, 20 Oct 2008 18:53:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ks3cx-0001M3-Nj for emacs-devel@gnu.org; Mon, 20 Oct 2008 18:53:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ks3cw-0001Lq-Fq for emacs-devel@gnu.org; Mon, 20 Oct 2008 18:53:30 -0400 Original-Received: from [199.232.76.173] (port=55741 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ks3cw-0001Ln-Ax for emacs-devel@gnu.org; Mon, 20 Oct 2008 18:53:30 -0400 Original-Received: from mtaout2.012.net.il ([84.95.2.4]:31597) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ks3cu-0003vZ-RD; Mon, 20 Oct 2008 18:53:29 -0400 Original-Received: from HOME-C4E4A596F7 ([77.126.98.197]) by i_mtaout2.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K9200MZ47NIHU20@i_mtaout2.012.net.il>; Tue, 21 Oct 2008 00:54:55 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104706 gmane.emacs.pretest.bugs:23269 Archived-At: > From: Andreas Schwab > Cc: 1212@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org > Date: Mon, 20 Oct 2008 23:28:21 +0200 > > Eli Zaretskii writes: > > >> From: Andreas Schwab > >> Cc: 1212@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org > >> Date: Mon, 20 Oct 2008 19:08:35 +0200 > >> > >> Why do you think that "Emacs Lisp quoting" has anything to do with > >> "shell command quoting"? > > > > Because I grep'ped Emacs sources for its users. > > That does not make it more suitable. You know, since you evidently know better, how about if you explained what that pair of functions is supposed to do, exactly, and what are their intended uses? The doc strings fall short by a large margin, and NEWS had this to say about these functions: *** `split-string-and-unquote' does (what?) *** `combine-and-quote-strings' does (what?) If I can understand the explanation, maybe I could produce from it a suitable section of the ELisp manual, which is the reason why I started to play with split-string-and-unquote. Failing that, I will stick to my interpretation. Here's what I wrote in the ELisp manual about these two functions; comments and corrections, if someone has them, are greatly appreciated: @cindex quoting and unquoting shell command line The following two functions help creating shell commands from individual argument strings and taking shell command lines apart into individual arguments. @defun split-string-and-unquote string &optional separators This function splits @var{string} into substrings at matches for the regular expression @var{separators}, like @code{split-string} does (@pxref{Creating Strings}), but it additionally removes quoting from the substrings. It then makes a list of the substrings and returns it. If @var{separators} is omitted or nil, it defaults to @code{"\\s-+"}, which is a regular expression that matches one or more characters with whitespace syntax (@pxref{Syntax Class Table}). The quoting this function supports is of 2 styles: by enclosing a whole string in double quotes @code{"@dots{}"}, or by quoting individual characters with a backslash escape @samp{\}. The latter is also used in Lisp strings, so this function can handle those as well. @end defun @defun combine-and-quote-strings list-of-strings &optional separator This function concatenates @var{list-of-strings} into a single string, quoting each string in the list that needs quoting as it goes. It also sticks the @var{separator} string in between each pair of strings in the result, and returns that result. If @var{separator} is omitted or @code{nil}, it defaults to a blank @code{" "}. The strings in @var{list-of-strings} that need quoting are those that include @var{separator} as their substring. Quoting a string encloses it in double quotes @code{"@dots{}"}. In the simplest case, if you are consing a shell command from the individual command-line arguments, every argument that includes embedded blanks will be quoted. @end defun