From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: Juanma Barranquero <lekktu@gmail.com>, 6299@debbugs.gnu.org
Subject: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3)
Date: Sun, 30 May 2010 10:18:44 -0400 [thread overview]
Message-ID: <jwvd3wd1o3e.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTil3UJocxpKFhVJd9rOdwWaKjSR4xgv8r7rDkY7m@mail.gmail.com> (Lennart Borgman's message of "Sun, 30 May 2010 12:11:50 +0200")
>>> What about (file-name-nondirectory "c:")?
ELISP> (file-name-nondirectory "c:")
>> ""
Good thanks.
>>> And what about (file-name-all-completions
>>> (file-name-nondirectory "c:")
>>> (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 problem.
Please confirm.
Stefan
=== 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)))
((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 accordingly.
- (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))
(t
(let* ((default-directory
next prev parent reply other threads:[~2010-05-30 14:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-29 1:35 bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Lennart Borgman
2010-05-29 16:12 ` Eli Zaretskii
2010-05-29 21:18 ` Stefan Monnier
2010-05-29 21:24 ` Lennart Borgman
2010-05-29 22:07 ` Lennart Borgman
2010-05-29 23:29 ` Stefan Monnier
2010-05-30 0:10 ` Lennart Borgman
2010-05-30 3:34 ` Stefan Monnier
2010-05-30 4:27 ` Juanma Barranquero
2010-05-30 10:11 ` Lennart Borgman
2010-05-30 14:18 ` Stefan Monnier [this message]
2010-05-30 17:40 ` Lennart Borgman
2010-05-30 21:18 ` Stefan Monnier
2010-05-30 13:39 ` Lennart Borgman
2010-05-30 14:05 ` Stefan Monnier
2010-05-30 17:39 ` Lennart Borgman
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=jwvd3wd1o3e.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=6299@debbugs.gnu.org \
--cc=lekktu@gmail.com \
--cc=lennart.borgman@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 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).