unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kenichi Handa <handa@m17n.org>
Cc: 9160@debbugs.gnu.org
Subject: bug#9160: 24.0.50; Emacs freezes in *shell* buffer.
Date: Sun, 28 Aug 2011 01:16:37 -0400	[thread overview]
Message-ID: <jwvr546azo6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <tl7ty96cnxa.fsf@m17n.org> (Kenichi Handa's message of "Thu, 25 Aug 2011 09:52:49 +0900")

> 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  <monnier@iro.umontreal.ca>
+
+	* shell.el (shell-parse-pcomplete-arguments): Unquote args (bug#9160).
+
 2011-08-27  Alan Mackenzie  <acm@muc.de>
 
 	* 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	other threads:[~2011-08-28  5:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 12:07 bug#9160: 24.0.50; Emacs freezes in *shell* buffer Kenichi Handa
2011-08-23  4:49 ` Stefan Monnier
2011-08-25  0:52   ` Kenichi Handa
2011-08-28  5:16     ` Stefan Monnier [this message]
2011-09-06  6:19       ` Kenichi Handa
2011-09-20  1:10         ` Stefan Monnier
2011-09-20  5:16           ` Kenichi Handa
2011-10-17 17:12             ` Stefan Monnier
2011-12-02 12:06               ` Kenichi Handa
2011-12-02 14:45                 ` Stefan Monnier
2011-12-04 13:41                   ` Kenichi Handa
2011-12-04 15:38                     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr546azo6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=9160@debbugs.gnu.org \
    --cc=handa@m17n.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).