all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Flo <sensorflo@gmail.com>
Cc: 7711@debbugs.gnu.org
Subject: bug#7711: Patch for bug #7687
Date: Fri, 21 Jan 2011 13:07:30 -0500	[thread overview]
Message-ID: <jwv39omkug8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTindQ6Sn39_3T+DkAe_+QcucqVt9Q+eNnKLWJTob@mail.gmail.com> (Flo's message of "Wed, 22 Dec 2010 20:00:51 +0100")

forcemerge 7687 7711
close 7711
thanks

> the empty string. The new version of shell-quote-argument
> treats newlines specially. They are quoted with single
> quotes.

Thanks.  I've installed a slightly different patch (took the opportunity
to simplify the code by using replace-regexp-in-string) that implements
your idea.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2011-01-21 05:04:45 +0000
+++ lisp/ChangeLog	2011-01-21 18:04:16 +0000
@@ -1,3 +1,8 @@
+2011-01-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* subr.el (shell-quote-argument): Properly quote \n (bug#7687).
+	Suggested by Flo <sensorflo@gmail.com>.
+
 2011-01-21  Glenn Morris  <rgm@gnu.org>
 
 	* progmodes/compile.el (compilation-error-regexp-alist):

=== modified file 'lisp/subr.el'
--- lisp/subr.el	2011-01-15 02:32:19 +0000
+++ lisp/subr.el	2011-01-21 18:04:45 +0000
@@ -2426,13 +2426,8 @@
         "''"
       ;; Quote everything except POSIX filename characters.
       ;; This should be safe enough even for really weird shells.
-      (let ((result "") (start 0) end)
-        (while (string-match "[^-0-9a-zA-Z_./]" argument start)
-          (setq end (match-beginning 0)
-                result (concat result (substring argument start end)
-                               "\\" (substring argument end (1+ end)))
-                start (1+ end)))
-        (concat result (substring argument start))))))
+      (replace-regexp-in-string "\n" "'\n'"
+       (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument)))))
 
 (defun string-or-null-p (object)
   "Return t if OBJECT is a string or nil.






      reply	other threads:[~2011-01-21 18:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 19:00 bug#7711: Patch for bug #7687 Flo
2011-01-21 18:07 ` Stefan Monnier [this message]

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

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

  git send-email \
    --in-reply-to=jwv39omkug8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=7711@debbugs.gnu.org \
    --cc=sensorflo@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.