From: Stephen Berman <stephen.berman@gmx.net>
To: Tim Van Holder <tim.vanholder@gmail.com>
Cc: 7215@debbugs.gnu.org
Subject: bug#7215: 24.0.50; Minibuffer path completion mispositions point
Date: Fri, 15 Oct 2010 16:08:51 +0200 [thread overview]
Message-ID: <8762x3v98s.fsf@escher.home> (raw)
In-Reply-To: <87aamgc3jr.fsf@leeloo.anubex.internal> (Tim Van Holder's message of "Thu, 14 Oct 2010 15:22:16 +0200")
[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]
On Thu, 14 Oct 2010 15:22:16 +0200 Tim Van Holder <tim.vanholder@gmail.com> wrote:
> Recipe:
>
> $ mkdir directory
> $ cd directory
> $ mkdir subdir
> $ cd subdir
> $ emacs -Q
> C-x C-f
>
> At this point, the minibuffer will contain (with * indicating point):
>
> Find file: .../directory/subdir/*
>
> Now delete most of "directory", leaving the minibuffer as:
>
> Find file: .../dir*/subdir/
>
> Now press [tab]. This correctly completes "dir" back to "directory", but
> also moves point backwards, resulting in:
>
> Find file: .../di*rectory/subdir/
>
> The amount point moves seems to be relative to the place it should end
> up at (it will always be after the "di" regardless of whether the
> completion was for "di", "dir" or "direc"). It also seems to be related
> to the size of the subsequent path component; doing the same tab
> completion for the portion of the path before "directory" makes point
> jump much further back.
>
> For the last path component (subdir in this case) it _looks_ fine,
> resulting in
>
> Find file: .../directory/subdir*/
>
> But simply adding a single letter after the trailing '/' shows that this
> is just the one case where it looks like it's doing the right thing;
> trying to complete "subdir" from "sub" then yields:
>
> Find file: .../directory/subdi*r/x
The following patch appears to fix this problem (that is, it leaves
point before the `/' following the current path component; note that in
Emacs 23.1, path completion leaves point after the `/'):
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: completion patch --]
[-- Type: text/x-patch, Size: 906 bytes --]
*** /data/steve/bzr/emacs/trunk/lisp/minibuffer.el 2010-10-08 13:54:31.000000000 +0200
--- /data/steve/bzr/emacs/quickfixes/lisp/minibuffer.el 2010-10-15 15:46:18.000000000 +0200
***************
*** 574,580 ****
;; Insert in minibuffer the chars we got.
(completion--replace beg end completion))
;; Move point to its completion-mandated destination.
! (forward-char (- comp-pos (length completion)))
(if (not (or unchanged completed))
;; The case of the string changed, but that's all. We're not sure
--- 574,580 ----
;; Insert in minibuffer the chars we got.
(completion--replace beg end completion))
;; Move point to its completion-mandated destination.
! ;; (forward-char (- comp-pos (length completion)))
(if (not (or unchanged completed))
;; The case of the string changed, but that's all. We're not sure
[-- Attachment #3: Type: text/plain, Size: 332 bytes --]
Clearly, the movement calculation doesn't DTRT for path completion. I
tried the patch with other types of completion, e.g. function and
variable names, and it also seemed fine. But the movement is obviously
intended, so there must be cases I have overlooked where it is needed;
maybe for certain completion styles?
Steve Berman
next prev parent reply other threads:[~2010-10-15 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 13:22 bug#7215: 24.0.50; Minibuffer path completion mispositions point Tim Van Holder
2010-10-15 14:08 ` Stephen Berman [this message]
2010-10-17 17:31 ` Stefan Monnier
2010-10-18 6:56 ` Tim Van Holder
2010-10-18 14:24 ` Stefan Monnier
2010-10-18 20:03 ` 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=8762x3v98s.fsf@escher.home \
--to=stephen.berman@gmx.net \
--cc=7215@debbugs.gnu.org \
--cc=tim.vanholder@gmail.com \
/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.