From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Date: Sun, 30 May 2010 10:18:44 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1275229669 30515 80.91.229.12 (30 May 2010 14:27:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 May 2010 14:27:49 +0000 (UTC) Cc: Juanma Barranquero , 6299@debbugs.gnu.org To: Lennart Borgman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 30 16:27:44 2010 connect(): No such file or directory 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 1OIjUN-0004c5-Te for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 May 2010 16:27:44 +0200 Original-Received: from localhost ([127.0.0.1]:47402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIjUN-0006j9-4Z for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 May 2010 10:27:43 -0400 Original-Received: from [140.186.70.92] (port=43829 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIjUH-0006g8-8M for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 10:27:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OIjUF-0001nC-R6 for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 10:27:37 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45435) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIjUF-0001n8-Oc for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 10:27:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OIjMx-00010I-6f; Sun, 30 May 2010 10:20:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 May 2010 14:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6299 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6299-submit@debbugs.gnu.org id=B6299.12752291443843 (code B ref 6299); Sun, 30 May 2010 14:20:03 +0000 Original-Received: (at 6299) by debbugs.gnu.org; 30 May 2010 14:19:04 +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 1OIjLz-0000zw-I2 for submit@debbugs.gnu.org; Sun, 30 May 2010 10:19:03 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIjLx-0000zZ-09 for 6299@debbugs.gnu.org; Sun, 30 May 2010 10:19:01 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEACsRAkxMCpdY/2dsb2JhbACeNHK9UoUWBIxM X-IronPort-AV: E=Sophos;i="4.53,327,1272859200"; d="scan'208";a="66008947" Original-Received: from 76-10-151-88.dsl.teksavvy.com (HELO pastel.home) ([76.10.151.88]) by ironport2-out.pppoe.ca with ESMTP; 30 May 2010 10:18:44 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 6571181F8; Sun, 30 May 2010 10:18:44 -0400 (EDT) In-Reply-To: (Lennart Borgman's message of "Sun, 30 May 2010 12:11:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 30 May 2010 10:20:03 -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:37421 Archived-At: >>> What about (file-name-nondirectory "c:")? ELISP> (file-name-nondirectory "c:") >> "" Good thanks. >>> And what about (file-name-all-completions >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(file-name-nondirectory "c:") >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(file-name-directory "c:")) ? >> Returns all files and dirs in C:/ Again, thank you. > The same + tramp's symbols (fcp:, psftp:, plinkx: etc) and tramp's > usernames ("some.one@" etc). Not sure if that's correct, but it's a separate problem. I've installed the patch below which should hopefully fix the original prob= lem. Please confirm. Stefan =3D=3D=3D modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2010-05-12 00:39:46 +0000 +++ lisp/minibuffer.el 2010-05-30 14:13:36 +0000 @@ -1342,7 +1342,14 @@ ((eq (car-safe action) 'boundaries) (let ((start (length (file-name-directory string))) (end (string-match-p "/" (cdr action)))) - (list* 'boundaries start end))) + (list* 'boundaries + ;; if `string' is "C:" in w32, (file-name-directory string) + ;; returns "C:/", so `start' is 3 rather than 2. + ;; Not quite sure what is The Right Fix, but clipping it + ;; back to 2 will work for this particular case. We'll + ;; see if we can come up with a better fix when we bump + ;; into more such problematic cases. + (min start (length string)) end))) =20 ((eq action 'lambda) (if (zerop (length string)) @@ -1395,17 +1402,18 @@ (cond ((eq (car-safe action) 'boundaries) ;; For the boundaries, we can't really delegate to - ;; completion-file-name-table and then fix them up, because it - ;; would require us to track the relationship between `str' and + ;; substitute-in-file-name+completion-file-name-table and then fix + ;; them up (as we do for the other actions), because it would + ;; require us to track the relationship between `str' and ;; `string', which is difficult. And in any case, if - ;; substitute-in-file-name turns "fo-$TO-ba" into "fo-o/b-ba", there's - ;; no way for us to return proper boundaries info, because the - ;; boundary is not (yet) in `string'. - ;; FIXME: Actually there is a way to return correct boundaries info, - ;; at the condition of modifying the all-completions return accordingl= y. - (let ((start (length (file-name-directory string))) - (end (string-match-p "/" (cdr action)))) - (list* 'boundaries start end))) + ;; substitute-in-file-name turns "fo-$TO-ba" into "fo-o/b-ba", + ;; there's no way for us to return proper boundaries info, because + ;; the boundary is not (yet) in `string'. + ;; + ;; FIXME: Actually there is a way to return correct boundaries + ;; info, at the condition of modifying the all-completions + ;; return accordingly. But for now, let's not bother. + (completion-file-name-table string pred action)) =20 (t (let* ((default-directory