From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#7215: 24.0.50; Minibuffer path completion mispositions point Date: Fri, 15 Oct 2010 16:08:51 +0200 Message-ID: <8762x3v98s.fsf@escher.home> References: <87aamgc3jr.fsf@leeloo.anubex.internal> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1287153338 7809 80.91.229.12 (15 Oct 2010 14:35:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 15 Oct 2010 14:35:38 +0000 (UTC) Cc: 7215@debbugs.gnu.org To: Tim Van Holder Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 15 16:35:36 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P6lNe-00058S-I6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 Oct 2010 16:35:36 +0200 Original-Received: from localhost ([127.0.0.1]:53242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6lNc-00071s-AP for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 Oct 2010 10:35:32 -0400 Original-Received: from [140.186.70.92] (port=38516 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6l8H-00047K-AX for bug-gnu-emacs@gnu.org; Fri, 15 Oct 2010 10:19:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6l19-0000xD-3e for bug-gnu-emacs@gnu.org; Fri, 15 Oct 2010 10:12:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6l19-0000x9-1P for bug-gnu-emacs@gnu.org; Fri, 15 Oct 2010 10:12:19 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P6kv3-0006Xw-Pk; Fri, 15 Oct 2010 10:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Oct 2010 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7215-submit@debbugs.gnu.org id=B7215.128715152225156 (code B ref 7215); Fri, 15 Oct 2010 14:06:01 +0000 Original-Received: (at 7215) by debbugs.gnu.org; 15 Oct 2010 14:05:22 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6kuP-0006Xh-NY for submit@debbugs.gnu.org; Fri, 15 Oct 2010 10:05:21 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1P6kuN-0006Xc-BQ for 7215@debbugs.gnu.org; Fri, 15 Oct 2010 10:05:20 -0400 Original-Received: (qmail invoked by alias); 15 Oct 2010 14:08:52 -0000 Original-Received: from i59F54169.versanet.de (EHLO escher.home) [89.245.65.105] by mail.gmx.net (mp040) with SMTP; 15 Oct 2010 16:08:52 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1/ZpMtZ44nZZGA6yV8DZlmHpqwhjFNcZO6SoOwUQ4 I97C3kd64CfBd5 Original-Received: by escher.home (Postfix, from userid 1000) id 3924110303; Fri, 15 Oct 2010 16:08:52 +0200 (CEST) In-Reply-To: <87aamgc3jr.fsf@leeloo.anubex.internal> (Tim Van Holder's message of "Thu, 14 Oct 2010 15:22:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 15 Oct 2010 10:06:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40909 Archived-At: --=-=-= Content-Type: text/plain 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 `/'): --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: completion patch *** /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 --=-=-= Content-Type: text/plain 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 --=-=-=--