bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#9160: 24.0.50; Emacs freezes in *shell* buffer.


From: Stefan Monnier
Subject: bug#9160: 24.0.50; Emacs freezes in *shell* buffer.
Date: Sun, 28 Aug 2011 01:16:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> Thank you I confirmed that the above test case now works.
> But, found another bug.  If I use `rm' command instead of
> `ls':
>   % rm 0\ TAB
> the completion doesn't work and I just see a message "No
> match".

If there's not space after the backslash, then that's a bug that's
already in Emacs-23, and I don't know yet how to fix it.
When there is a space after the backslash, we indeed have a bug and
I think I've fixed it with the patch below.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2011-08-27 08:41:23 +0000
+++ lisp/ChangeLog      2011-08-28 05:14:29 +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'
--- lisp/shell.el       2011-08-23 05:25:17 +0000
+++ lisp/shell.el       2011-08-28 04:21:05 +0000
@@ -393,10 +393,28 @@
       (while (< (point) end)
        (skip-chars-forward " \t\n")
        (push (point) begins)
-        (looking-at 
"\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?")
+        (let ((arg ()))
+          (while (looking-at
+                  (eval-when-compile
+                    (concat
+                     "\\(?:[^\s\t\n\\\"']+"
+                     "\\|'\\([^']*\\)'?"
+                     "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
+                     "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))
         (goto-char (match-end 0))
-       (push (buffer-substring-no-properties (car begins) (point))
-              args))
+            (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]