diff options
author | Chong Yidong <cyd@gnu.org> | 2012-01-28 21:58:46 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-01-28 21:58:46 +0800 |
commit | 93376c5baf50aab8e5095c083ad11dcf9caff36a (patch) | |
tree | 5c0bce5e5ae9ddeece76c77c99af0f5d67e544ff /lisp/eshell/esh-arg.el | |
parent | 8c6e1920922a40d25b440478af6ea5c52ebfdf06 (diff) | |
download | emacs-93376c5baf50aab8e5095c083ad11dcf9caff36a.tar.gz emacs-93376c5baf50aab8e5095c083ad11dcf9caff36a.tar.bz2 emacs-93376c5baf50aab8e5095c083ad11dcf9caff36a.zip |
Quote file name commands in eshell.
* lisp/eshell/esh-arg.el (eshell-quote-argument): New function.
* lisp/eshell/esh-ext.el (eshell-invoke-batch-file):
* lisp/eshell/em-unix.el (eshell/cat, eshell/du): Use it to quote the
first arg to eshell-parse-command.
Fixes: debbugs:10523
Diffstat (limited to 'lisp/eshell/esh-arg.el')
-rw-r--r-- | lisp/eshell/esh-arg.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 8143f2d65be..ad52a5d4a71 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el @@ -202,6 +202,18 @@ If POS is nil, the location of point is checked." (or (= pos (point-max)) (memq (char-after pos) eshell-delimiter-argument-list)))) +(defun eshell-quote-argument (string) + "Return STRING with magic characters quoted. +Magic characters are those in `eshell-special-chars-outside-quoting'." + (let ((index 0)) + (mapconcat (lambda (c) + (prog1 + (or (eshell-quote-backslash string index) + (char-to-string c)) + (setq index (1+ index)))) + string + ""))) + ;; Argument parsing (defun eshell-parse-arguments (beg end) |