unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andreas Schwab <schwab@suse.de>
Cc: emacs-pretest-bug@gnu.org, 1212@emacsbugs.donarmstrong.com,
	emacs-devel@gnu.org
Subject: bug#1212: 23.0.60; split-string-and-unquote problems
Date: Tue, 21 Oct 2008 00:53:30 +0200	[thread overview]
Message-ID: <u63nmj2tx.fsf__40833.9166468524$1224546508$gmane$org@gnu.org> (raw)
In-Reply-To: <jefxmrq7m2.fsf@sykes.suse.de>

> From: Andreas Schwab <schwab@suse.de>
> Cc: 1212@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org
> Date: Mon, 20 Oct 2008 23:28:21 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Andreas Schwab <schwab@suse.de>
> >> 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






  parent reply	other threads:[~2008-10-20 22:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20 16:04 bug#1212: 23.0.60; split-string-and-unquote problems Eli Zaretskii
2008-10-20 17:01 ` Andreas Schwab
2008-10-20 19:06   ` Eli Zaretskii
2008-10-20 21:30     ` Andreas Schwab
2008-10-20 22:36       ` Eli Zaretskii
2008-10-21  9:25         ` Andreas Schwab
2008-10-21 10:18           ` Eli Zaretskii
2008-10-21 11:00             ` Andreas Schwab
2008-10-21 11:33               ` Eli Zaretskii
2008-10-21 11:49                 ` Andreas Schwab
2008-10-21 12:25                   ` Eli Zaretskii
2008-10-21 12:50                     ` Andreas Schwab
2008-10-21 12:58                       ` Eli Zaretskii
2008-10-21 13:24                         ` Andreas Schwab
2008-10-21 13:36                           ` Eli Zaretskii
2008-10-21 13:44                             ` Andreas Schwab
2008-10-21 15:13                               ` Eli Zaretskii
2008-10-20 17:08 ` Andreas Schwab
2008-10-20 19:16   ` Eli Zaretskii
2008-10-20 21:28     ` Andreas Schwab
2008-10-20 22:53       ` Eli Zaretskii
2008-10-20 22:53       ` Eli Zaretskii [this message]
     [not found]       ` <u63nmj2tx.fsf@gnu.org>
2008-10-21  1:11         ` Stefan Monnier
2008-10-21  1:11         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='u63nmj2tx.fsf__40833.9166468524$1224546508$gmane$org@gnu.org' \
    --to=eliz@gnu.org \
    --cc=1212@emacsbugs.donarmstrong.com \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).