unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Aidan Gauland <aidalgol@no8wireless.co.nz>
To: 15385@debbugs.gnu.org
Cc: Joost Kremers <joostkremers@fastmail.fm>
Subject: bug#15385: [Eshell] Directory completion overwrites preceding characters
Date: Sat, 21 Sep 2013 16:06:10 +1200	[thread overview]
Message-ID: <87d2o2ddjh.fsf@dimension8.tehua.net> (raw)
In-Reply-To: <mailman.2172.1379254394.10748.bug-gnu-emacs@gnu.org> (Joost Kremers's message of "Sun, 15 Sep 2013 16:11:44 +0200")

The bug seems to be in pcomplete, line 1140 of pcomplete.el, to be
exact:

  (delete-char (- (length (comint-quote-filename stub))))

`comint-quote-filename' is given a relative path, "~/Dro", and returning
an absolute path, "/home/joost/Dropbox/".  The length of this is then
passed to `delete-char' to clear the argument being completed, but the
length is wrong when it's a relative path, because
`comint-quote-filename' seems to always return an absolute path.

I'm not sure how to fix this without breaking something else or leaving
out other special cases, such as ${FOO}tm[TAB], because I still don't
really understand how pcomplete works.  I still want to sit down with
pcomplete for a while and document it (it was left undocumented along
with Eshell, of which it was originally a component), so unless someone
else can come up with a good fix, this bug will have to remain
outstanding for a while, unfortunately.

--Aidan

Joost Kremers <joostkremers@fastmail.fm> writes:

> Starting from `emacs -Q', if I do
>
>    (setq eshell-cmpl-ignore-case t)
>
> and then start up a shell, TAB completion behaves incorrectly under some
> conditions.
>
> Specifically, I type a command such as:
>
>     $ cp ~/Dropbox/Work/Reading/Wilbur_Martinez2002.pdf ~/Dro
>
> At this point, I hit TAB to complete `~/Dro' and get:
>
>     $ cp ~/Dropbox/Work/Reading/Wilbur_Martine/home/joost/Dropbox/
>
> Note that the problem does *not* occur with the first file path. If I
> hit TAB to complete
>
>     $ cp ~/Dro
>
> then completion produces the correct result:
>
>     $ cp ~/Dropbox/
>
> It seems the problem occurs when the file path is the second argument on
> the command line, because if I type:
>
>     $ ls ~/Dropbox/Work/Literature/k/kim2002.pdf ~/dro
>
> and hit TAB to complete, the result is also:
>
>     $ ls ~/Dropbox/Work/Literature/k/ki/home/joost/Dropbox/
>
> It does not occur when there is a switch preceding the file path:
>
>     $ ls -l ~/dro
>
> completes fine.
>
> Thanks,
>
> Joost Kremers





       reply	other threads:[~2013-09-21  4:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2172.1379254394.10748.bug-gnu-emacs@gnu.org>
2013-09-21  4:06 ` Aidan Gauland [this message]
2013-09-15 14:11   ` bug#15385: [Eshell] Directory completion overwrites preceding characters Joost Kremers
2013-09-21 11:29     ` Thierry Volpiatto
2021-12-04  3:40     ` Lars Ingebrigtsen
2021-12-04 21:37       ` Joost Kremers
2021-12-04 22:14         ` Lars Ingebrigtsen
2013-09-21 14:42   ` Joost Kremers
     [not found]   ` <mailman.2634.1379763074.10748.bug-gnu-emacs@gnu.org>
2013-09-22 18:55     ` Aidan Gauland
     [not found]   ` <mailman.2651.1379774595.10748.bug-gnu-emacs@gnu.org>
2013-09-22 19:00     ` Aidan Gauland

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2o2ddjh.fsf@dimension8.tehua.net \
    --to=aidalgol@no8wireless.co.nz \
    --cc=15385@debbugs.gnu.org \
    --cc=joostkremers@fastmail.fm \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).