X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/09d9db2c4921cb2eb0974892164dd03d6bffdd80..93376c5baf50aab8e5095c083ad11dcf9caff36a:/lisp/eshell/esh-arg.el diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 1fb8b7f4c3..ad52a5d4a7 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el @@ -1,6 +1,6 @@ ;;; esh-arg.el --- argument processing -;; Copyright (C) 1999-2011 Free Software Foundation, Inc. +;; Copyright (C) 1999-2012 Free Software Foundation, Inc. ;; Author: John Wiegley @@ -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) @@ -311,7 +323,7 @@ special character that is not itself a backslash." (char-to-string (char-before)))) ;; allow \\ to mean a literal "\" character followed by a ;; normal return, rather than a backslash followed by a line - ;; continuator (i.e., "\\ + \n" rather than "\ + \\n"). This + ;; continuation (i.e., "\\ + \n" rather than "\ + \\n"). This ;; is necessary because backslashes in Eshell are not special ;; unless they either precede something special, or precede a ;; backslash that precedes something special. (Mainly this is