diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-05-01 02:03:16 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-05-01 02:03:16 +0000 |
commit | e1b65a6bd81fe9fe3ccb409861866789f6534c83 (patch) | |
tree | c75d89bb8d567e77250f60a4fbd5323b98c0c7c8 /lisp/subr.el | |
parent | 1dc6cfa61dbd868f5ab072e37d77fdd64ff5f251 (diff) | |
download | emacs-e1b65a6bd81fe9fe3ccb409861866789f6534c83.tar.gz |
(shell-quote-argument): Quote null string usefully.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index edd425d33e6..70fea7691b6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -873,15 +873,17 @@ If SEPARATORS is absent, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." argument (if (eq system-type 'windows-nt) (concat "\"" argument "\"") - ;; 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)))))) + (if (equal argument "") + "''" + ;; 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))))))) (defun make-syntax-table (&optional oldtable) "Return a new syntax table. |