summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-01-21 13:07:41 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-01-21 13:07:41 -0500
commitd5e632d853da69d61b488ac26773c547ac655c6a (patch)
tree4582434984560e25ec9e033aec13f0ddbcbdf121 /lisp/subr.el
parentd00b05c949aa1078922281188cdb74689077ddfa (diff)
downloademacs-d5e632d853da69d61b488ac26773c547ac655c6a.tar.gz
* lisp/subr.el (shell-quote-argument): Properly quote \n.
Suggested by Flo <sensorflo@gmail.com>. Fixes: debbugs:7687
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el9
1 files changed, 2 insertions, 7 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 2a0dee69338..391510c4acb 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2426,13 +2426,8 @@ Note: :data and :device are currently not supported on Windows."
"''"
;; 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.