emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106979: Quote file name commands in


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106979: Quote file name commands in eshell.
Date: Sat, 28 Jan 2012 21:58:46 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106979
fixes bug(s): http://debbugs.gnu.org/10523
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-01-28 21:58:46 +0800
message:
  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.
modified:
  lisp/ChangeLog
  lisp/eshell/em-unix.el
  lisp/eshell/esh-arg.el
  lisp/eshell/esh-ext.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-01-28 11:26:29 +0000
+++ b/lisp/ChangeLog    2012-01-28 13:58:46 +0000
@@ -1,3 +1,11 @@
+2012-01-28  Chong Yidong  <address@hidden>
+
+       * eshell/esh-arg.el (eshell-quote-argument): New function.
+
+       * eshell/esh-ext.el (eshell-invoke-batch-file):
+       * eshell/em-unix.el (eshell/cat, eshell/du): Use it to quote the
+       first arg to eshell-parse-command (Bug#10523).
+
 2012-01-28  Drew Adams  <address@hidden>
 
        * net/ange-ftp.el (ange-ftp-canonize-filename): Check, that

=== modified file 'lisp/eshell/em-unix.el'
--- a/lisp/eshell/em-unix.el    2012-01-23 08:18:22 +0000
+++ b/lisp/eshell/em-unix.el    2012-01-28 13:58:46 +0000
@@ -599,7 +599,7 @@
       (let ((ext-cat (eshell-search-path "cat")))
        (if ext-cat
            (throw 'eshell-replace-command
-                  (eshell-parse-command ext-cat args))
+                  (eshell-parse-command (eshell-quote-argument ext-cat) args))
          (if eshell-in-pipeline-p
              (error "Eshell's `cat' does not work in pipelines")
            (error "Eshell's `cat' cannot display one of the files given"))))
@@ -855,7 +855,7 @@
                           (file-remote-p (expand-file-name arg) 'method) "ftp")
                          (throw 'have-ange-path t))))))
        (throw 'eshell-replace-command
-              (eshell-parse-command ext-du args))
+              (eshell-parse-command (eshell-quote-argument ext-du) args))
       (eshell-eval-using-options
        "du" args
        '((?a "all" nil show-all

=== modified file 'lisp/eshell/esh-arg.el'
--- a/lisp/eshell/esh-arg.el    2012-01-19 07:21:25 +0000
+++ b/lisp/eshell/esh-arg.el    2012-01-28 13:58:46 +0000
@@ -202,6 +202,18 @@
     (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)

=== modified file 'lisp/eshell/esh-ext.el'
--- a/lisp/eshell/esh-ext.el    2012-01-19 07:21:25 +0000
+++ b/lisp/eshell/esh-ext.el    2012-01-28 13:58:46 +0000
@@ -108,7 +108,9 @@
   ;; argument...
   (setcar args (subst-char-in-string ?/ ?\\ (car args)))
   (throw 'eshell-replace-command
-        (eshell-parse-command eshell-windows-shell-file (cons "/c" args))))
+        (eshell-parse-command
+         (eshell-quote-argument eshell-windows-shell-file)
+         (cons "/c" args))))
 
 (defcustom eshell-interpreter-alist
   (if (eshell-under-windows-p)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]