emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105595: * lisp/shell.el (shell-parse


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105595: * lisp/shell.el (shell-parse-pcomplete-arguments): Unquote args.
Date: Sun, 28 Aug 2011 01:15:17 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105595
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9160
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sun 2011-08-28 01:15:17 -0400
message:
  * lisp/shell.el (shell-parse-pcomplete-arguments): Unquote args.
modified:
  lisp/ChangeLog
  lisp/shell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-27 08:41:23 +0000
+++ b/lisp/ChangeLog    2011-08-28 05:15:17 +0000
@@ -1,3 +1,7 @@
+2011-08-28  Stefan Monnier  <address@hidden>
+
+       * shell.el (shell-parse-pcomplete-arguments): Unquote args (bug#9160).
+
 2011-08-27  Alan Mackenzie  <address@hidden>
 
        * progmodes/cc-menus.el (cc-imenu-c++-generic-expression): Make it

=== modified file 'lisp/shell.el'
--- a/lisp/shell.el     2011-08-23 05:25:17 +0000
+++ b/lisp/shell.el     2011-08-28 05:15:17 +0000
@@ -393,10 +393,28 @@
       (while (< (point) end)
        (skip-chars-forward " \t\n")
        (push (point) begins)
-        (looking-at 
"\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?")
-        (goto-char (match-end 0))
-       (push (buffer-substring-no-properties (car begins) (point))
-              args))
+        (let ((arg ()))
+          (while (looking-at
+                  (eval-when-compile
+                    (concat
+                     "\\(?:[^\s\t\n\\\"']+"
+                     "\\|'\\([^']*\\)'?"
+                     "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
+                     "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))
+            (goto-char (match-end 0))
+            (cond
+             ((match-beginning 3)       ;Backslash escape.
+              (push (if (= (match-beginning 3) (match-end 3))
+                        "\\" (match-string 3))
+                    arg))
+             ((match-beginning 2)       ;Double quote.
+              (push (replace-regexp-in-string
+                     "\\\\\\(.\\)" "\\1" (match-string 2))
+                    arg))
+             ((match-beginning 1)       ;Single quote.
+              (push (match-string 1) arg))
+             (t (push (match-string 0) arg))))
+          (push (mapconcat #'identity (nreverse arg) "") args)))
       (cons (nreverse args) (nreverse begins)))))
 
 (defun shell-completion-vars ()


reply via email to

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