bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on


From: Stefan Monnier
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

>> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]