From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#9160: 24.0.50; Emacs freezes in *shell* buffer. Date: Tue, 23 Aug 2011 00:49:35 -0400 Message-ID: References: <87wrf7dgqt.fsf@m17n.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1314075047 25343 80.91.229.12 (23 Aug 2011 04:50:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 23 Aug 2011 04:50:47 +0000 (UTC) Cc: 9160@debbugs.gnu.org To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 23 06:50:43 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qviwk-0008Gi-Rr for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Aug 2011 06:50:43 +0200 Original-Received: from localhost ([::1]:58955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qviwj-0008CH-V2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Aug 2011 00:50:41 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qviwg-0008Bc-Bq for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2011 00:50:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qviwf-0002st-6Q for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2011 00:50:38 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59441) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qviwf-0002sp-4H for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2011 00:50:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Qviz0-0005Nj-1u; Tue, 23 Aug 2011 00:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Aug 2011 04:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9160 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9160-submit@debbugs.gnu.org id=B9160.131407512620618 (code B ref 9160); Tue, 23 Aug 2011 04:53:01 +0000 Original-Received: (at 9160) by debbugs.gnu.org; 23 Aug 2011 04:52:06 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qviy6-0005MU-5w for submit@debbugs.gnu.org; Tue, 23 Aug 2011 00:52:06 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qviy3-0005ML-5J for 9160@debbugs.gnu.org; Tue, 23 Aug 2011 00:52:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAHgwU05Ld+HZ/2dsb2JhbABBqCF4gUABAQQBViMFCws0EhQYDSSIBLYKhkgEn3OEOA X-IronPort-AV: E=Sophos;i="4.68,267,1312171200"; d="scan'208";a="132334446" Original-Received: from 75-119-225-217.dsl.teksavvy.com (HELO ceviche.home) ([75.119.225.217]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 23 Aug 2011 00:49:36 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id D21596610A; Tue, 23 Aug 2011 00:49:35 -0400 (EDT) In-Reply-To: <87wrf7dgqt.fsf@m17n.org> (Kenichi Handa's message of "Sun, 24 Jul 2011 21:07:22 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 23 Aug 2011 00:53:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50234 Archived-At: > The latest trunk Emacs freezes in *shell* buffer in the > following scenario. > % emacs -Q > M-x shell RET > .. in *shell* buffer > % mkdir tmp (or if you already have tmp dir, % rm -rf tmp; mkdir tmp) > % cd tmp > % touch '0 a' '0-a' > % ls 0 > .. here is a single tab and *Completions* buffer is > shown with this contents ... > ------------------------------------------------------------ > Click on ... > In this buffer, ... `ls 0\ TAB' hangs as well, but with the advantage that it can be stopped with C-g, making it easier to debug. I've installed the patch below which should fix the immediate problem as well as improve completion behavior when you use "&&", pipes, or ";". Stefan === modified file 'lisp/pcomplete.el' --- lisp/pcomplete.el 2011-06-17 18:52:46 +0000 +++ lisp/pcomplete.el 2011-08-23 04:44:56 +0000 @@ -811,15 +811,19 @@ (while (< (point) end) (skip-chars-forward " \t\n") (push (point) begins) - (let ((skip t)) - (while skip - (skip-chars-forward "^ \t\n") - (if (eq (char-before) ?\\) - (skip-chars-forward " \t\n") - (setq skip nil)))) + (while + (progn + (skip-chars-forward "^ \t\n\\") + (when (eq (char-after) ?\\) + (forward-char 1) + (unless (eolp) + (forward-char 1) + t)))) (push (buffer-substring-no-properties (car begins) (point)) args)) (cons (nreverse args) (nreverse begins))))) +(make-obsolete 'pcomplete-parse-comint-arguments + 'comint-parse-pcomplete-arguments "24.1") (defun pcomplete-parse-arguments (&optional expand-p) "Parse the command line arguments. Most completions need this info." === modified file 'lisp/shell.el' --- lisp/shell.el 2011-06-17 18:52:46 +0000 +++ lisp/shell.el 2011-08-23 04:46:07 +0000 @@ -383,6 +383,21 @@ :group 'shell :type '(choice (const nil) regexp)) +(defun shell-parse-pcomplete-arguments () + "Parse whitespace separated arguments in the current region." + (let ((begin (save-excursion (shell-backward-command 1) (point))) + (end (point)) + begins args) + (save-excursion + (goto-char begin) + (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)) + (cons (nreverse args) (nreverse begins))))) (defun shell-completion-vars () "Setup completion vars for `shell-mode' and `read-shell-command'." @@ -396,8 +411,7 @@ (set (make-local-variable 'comint-dynamic-complete-functions) shell-dynamic-complete-functions) (set (make-local-variable 'pcomplete-parse-arguments-function) - ;; FIXME: This function should be moved to shell.el. - #'pcomplete-parse-comint-arguments) + #'shell-parse-pcomplete-arguments) (set (make-local-variable 'pcomplete-termination-string) (cond ((not comint-completion-addsuffix) "") ((stringp comint-completion-addsuffix)