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: Tue, 23 Aug 2011 00:49:35 -0400 [thread overview]
Message-ID: <jwv4o18pwdr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87wrf7dgqt.fsf@m17n.org> (Kenichi Handa's message of "Sun, 24 Jul 2011 21:07:22 +0900")
> 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<TAB>
> .. here <TAB> is a single tab and *Completions* buffer is
> shown with this contents ...
> ------------------------------------------------------------
> Click <mouse-2> 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)
next prev parent reply other threads:[~2011-08-23 4:49 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 [this message]
2011-08-25 0:52 ` Kenichi Handa
2011-08-28 5:16 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv4o18pwdr.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.