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#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows Date: Fri, 04 May 2012 19:32:41 -0400 Message-ID: References: <83obqeiwb0.fsf@gnu.org> <83mx5n6ceu.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1336174407 32457 80.91.229.3 (4 May 2012 23:33:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 4 May 2012 23:33:27 +0000 (UTC) Cc: 11348@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 05 01:33:26 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SQS02-00012N-2t for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 May 2012 01:33:22 +0200 Original-Received: from localhost ([::1]:45810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQS01-0004pU-Dc for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 May 2012 19:33:21 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQRzx-0004pM-Sv for bug-gnu-emacs@gnu.org; Fri, 04 May 2012 19:33:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQRzw-0004l2-8y for bug-gnu-emacs@gnu.org; Fri, 04 May 2012 19:33:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQRzw-0004ky-5G for bug-gnu-emacs@gnu.org; Fri, 04 May 2012 19:33:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SQS1d-0007yk-L1 for bug-gnu-emacs@gnu.org; Fri, 04 May 2012 19:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 May 2012 23:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11348 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11348-submit@debbugs.gnu.org id=B11348.133617447730638 (code B ref 11348); Fri, 04 May 2012 23:35:01 +0000 Original-Received: (at 11348) by debbugs.gnu.org; 4 May 2012 23:34:37 +0000 Original-Received: from localhost ([127.0.0.1]:36488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SQS1E-0007y6-WE for submit@debbugs.gnu.org; Fri, 04 May 2012 19:34:37 -0400 Original-Received: from ironport-out.teksavvy.com ([206.248.143.162]:8526) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SQS1C-0007xv-PA for 11348@debbugs.gnu.org; Fri, 04 May 2012 19:34:35 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjEKACxOgk9MCqD5/2dsb2JhbABDtheCDAOBDIEIggkBAQQBViMFCws0EhQYDSSIHAW2MothhHkEpEWBXYMD X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="178418008" Original-Received: from 76-10-160-249.dsl.teksavvy.com (HELO ceviche.home) ([76.10.160.249]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 May 2012 19:32:42 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id ED81C66109; Fri, 4 May 2012 19:32:41 -0400 (EDT) In-Reply-To: <83mx5n6ceu.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 May 2012 21:15:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:59762 Archived-At: >> This said, based on your description, the problem may simply come from >> shell.el's setting of pcomplete-arg-quote-list which tells pcomplete >> that \ is an escape char. >> I.e. does the patch below fix the problem? > No, I still get "d:\/gnu/". >> > This works better, it produces "cd d:\gnu/ ", which is ugly, but >> > correct. >> Which part is ugly? The \, the /, or the use of a mix of them? > The mix. >> > Perhaps Stefan could at some point add some documentation about the >> > internals, that would allow mere mortals such as myself debug the >> > completion code. >> I'd love to, but I'm much too deeply in it to know what needs more >> documentation, so fire away your questions and I'll reply with >> comments&docstrings. > A useful beginning would be some overview of the design and AFAIK that's in the lispref, but clearly that's not sufficient for you, so please be more specific. > description of the control and data flow in several popular use-cases. Not sure what that could look like. Would the following be helpful? For completion--file-name-table, after hitting TAB, here's the general way it is supposed to work (seen from the completion-table): - the `metadata' method is called, so the caller can know which completion styles should be used, as well as whether escaping/quoting should take place. - because file-names in the minibuffer are quoted (the unquoting replaces $$ with $ and expands envvars), which is evidenced by the fact that the completion-table is defined with completion-table-with-quoting, the text to be completed is unquoted and the (quoting)completion table is replaced by the "plain" completion table (the details of how this is done is internal to completion-table-with-quoting). - the completion goes on in the simpler unquoted world of file names (using the completion-file-name-table). - each completion style is attempted in sequence, and can use the `try-completion' method for simple prefix-based completion, as well as `all-completions' and `completion-boundaries' methods for more complex styles (the `completion-boundaries' method indicates which part of the completed string is *not* included in `all-completions'; in the case of file-name the part that's not included is the directory part). The returned completion is accompanied with some information about where point should go. - once a style returns a valid completion, that completion is re-quoted (because of the use of completion-table-with-quoting) and the corresponding position of point in the quoted string is computed. Stefan