GNU bug report logs - #6299
In read-file-name: (args-out-of-range "c:" 0 3)

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Sat, 29 May 2010 01:36:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Subject: bug#6299: closed (Re: bug#6299: In read-file-name:
 (args-out-of-range "c:" 0 3))
Date: Sun, 30 May 2010 23:04:01 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#6299: In read-file-name: (args-out-of-range "c:" 0 3)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 6299 <at> debbugs.gnu.org.

-- 
6299: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6299
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: Juanma Barranquero <lekktu <at> gmail.com>
Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3)
Date: Sun, 30 May 2010 17:18:57 -0400
>> I've installed the patch below which should hopefully fix the
>> original problem.  Please confirm.
> Thanks, it works.

Good thing done,

> I meant the argument ACTION to some function, but what exactly was
> I reading??
[...]
> There is no ACTION arg to try-completion etc.

The ACTION is not passed to try-completion but from try-completion to
the completion table (when it's a function).  I've just installed the
patch below to try and improve the documentation of those issues.


        Stefan


=== modified file 'doc/lispref/minibuf.texi'
--- doc/lispref/minibuf.texi	2010-05-03 22:01:23 +0000
+++ doc/lispref/minibuf.texi	2010-05-30 21:10:01 +0000
@@ -812,6 +812,24 @@
 If @var{collection} is a function, it is called with three arguments,
 the values @var{string}, @var{predicate} and @code{lambda}; whatever
 it returns, @code{test-completion} returns in turn.
+
+@defun completion-boundaries string collection predicate suffix
+This function returns the boundaries of the field on which @var{collection}
+will operate, assuming that @var{string} holds the text before point
+and @var{suffix} holds the text after point.
+
+Normally completion operates on the whole string, so for all normal
+collections, this will always return @code{(0 . (length
+@var{suffix}))}.  But more complex completion such as completion on
+files is done one field at a time.  For example, completion of
+@code{"/usr/sh"} will include @code{"/usr/share/"} but not
+@code{"/usr/share/doc"} even if @code{"/usr/share/doc"} exists.
+Also @code{all-completions} on @code{"/usr/sh"} will not include
+@code{"/usr/share/"} but only @code{"share/"}.  So if @var{string} is
+@code{"/usr/sh"} and @var{suffix} is @code{"e/doc"},
+@code{completion-boundaries} will return @code{(5 . 1)} which tells us
+that the @var{collection} will only return completion information that
+pertains to the area after @code{"/usr/"} and before @code{"/doc"}.
 @end defun
 
 If you store a completion alist in a variable, you should mark the
@@ -1618,13 +1636,14 @@
 can supply your own function to compute the completion of a given
 string.  This is called @dfn{programmed completion}.  Emacs uses
 programmed completion when completing file names (@pxref{File Name
-Completion}).
+Completion}), among many other cases.
 
-  To use this feature, pass a symbol with a function definition as the
-@var{collection} argument to @code{completing-read}.  The function
+  To use this feature, pass a function as the @var{collection}
+argument to @code{completing-read}.  The function
 @code{completing-read} arranges to pass your completion function along
-to @code{try-completion} and @code{all-completions}, which will then let
-your function do all the work.
+to @code{try-completion}, @code{all-completions}, and other basic
+completion functions, which will then let your function do all
+the work.
 
   The completion function should accept three arguments:
 
@@ -1638,10 +1657,14 @@
 and ignore the possible match if the predicate returns @code{nil}.
 
 @item
-A flag specifying the type of operation.
+A flag specifying the type of operation.  The best way to think about
+it is that the function stands for an object (in the
+``object-oriented'' sense of the word), and this third argument
+specifies which method to run.
 @end itemize
 
-  There are three flag values for three operations:
+  There are currently four methods, i.e. four flag values, one for
+  each of the four different basic operations:
 
 @itemize @bullet
 @item
@@ -1663,6 +1686,13 @@
 @code{lambda} specifies @code{test-completion}.  The completion
 function should return @code{t} if the specified string is an exact
 match for some possibility; @code{nil} otherwise.
+
+@item
+@code{(boundaries . SUFFIX)} specifies @code{completion-boundaries}.
+The function should return a value of the form @code{(boundaries
+START . END)} where START is the position of the beginning boundary in
+in the string to complete, and END is the position of the end boundary
+in SUFFIX.
 @end itemize
 
   It would be consistent and clean for completion functions to allow


[Message part 3 (message/rfc822, inline)]
From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: In read-file-name: (args-out-of-range "c:" 0 3)
Date: Sat, 29 May 2010 03:35:00 +0200
I get this backtrace below in certain cases when doing C-x C-f and entering

  c:/ema TAB

in the minibuffer. I have no good idea of how to debug it.

It happens only after I have loaded a multi major mode file. However
it happens not after just loading mumamo.el.

If I enter

  c:/emacs/something TAB

it does not happen either, i.e. it happens only before the second "/".

Tramp is loaded after the first TAB above but that is loaded in both
the cases where I get an error and those where I do not get it. (I
have no idea why tramp is loaded though.)

I do not know if I can track this down to something more simple so I
ask for suggestions and qualified guesses instead. Anyone has some?

This is with a checkout from 2010-05-22, my patched version.


Debugger entered--Lisp error: (args-out-of-range "c:" 0 3)
  signal(args-out-of-range ("c:" 0 3))
  completion--some(#[(style) " 	\236A@\n \f
$\207" [style completion-styles-alist string table pred point] 5]
(basic partial-completion emacs22))
  completion-try-completion("c:/ema" read-file-name-internal file-exists-p 6)
  completion--do-completion()
  minibuffer-complete()
  call-interactively(minibuffer-complete nil nil)
  completing-read("Find file: " read-file-name-internal file-exists-p
nil "c:/emacs/p/100522/EmacsW32/nxhtml/util/" file-name-history
"c:/emacs/p/100522/EmacsW32/nxhtml/util/")
  ad-Orig-read-file-name("Find file: " nil
"c:/emacs/p/100522/EmacsW32/nxhtml/util/" nil nil nil)
  (setq ad-return-value (ad-Orig-read-file-name prompt dir
default-filename mustmatch initial predicate))
  (let ((viper-minibuffer-exit-hook ...)) (setq ad-return-value
(ad-Orig-read-file-name prompt dir default-filename mustmatch initial
predicate)))
  (let (ad-return-value) (let (...) (setq ad-return-value ...)) ad-return-value)
  read-file-name("Find file: " nil "c:/emacs/p/100522/EmacsW32/nxhtml/util/")
  (cons (read-file-name "Find file: " nil default-directory) (cond
(... ...) (... ...)))
  call-interactively(find-file nil nil)



This bug report was last modified 15 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.