On Thu, 14 Oct 2010 15:22:16 +0200 Tim Van Holder 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 `/'):