Subject: bug#20873: closed (Re: bug#20873: 24.5; shell command completion faulty)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 23 Jun 2015 01:27:03 +0000

Your bug report

#20873: 24.5; shell command completion faulty

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20873: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20873
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20873: 24.5; shell command completion faulty
From: Leo Liu <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Tue, 23 Jun 2015 09:26:35 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

version: 25.1

On 2015-06-23 06:13 +0800, Stefan Monnier wrote:
> Could be.  I don't have time to dig into it right now, but another
> option might be to change shell-backward-command instead.

OK. I put in a fix there. Thanks.

Leo

Subject: 24.5; shell command completion faulty
From: Leo Liu <[email-masked]>
To: [email-masked]
Date: Mon, 22 Jun 2015 21:24:50 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

1. M-x shell
2. Put a few spaces before entering `c' followed by TAB

No completion.

I wonder if the following is the right fix?

diff --git a/lisp/shell.el b/lisp/shell.el
index 6d69ca63..788b8169 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1134,7 +1134,9 @@ (defun shell-command-completion ()
     (if (and filename
 	     (save-match-data (not (string-match "[~/]" filename)))
 	     (eq (match-beginning 0)
-		 (save-excursion (shell-backward-command 1) (point))))
+		 (save-excursion (shell-backward-command 1)
+				 (skip-syntax-forward " ")
+				 (point))))
 	(shell--command-completion-data))))
 
 (defun shell--command-completion-data ()