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 17:18:57 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1275262075 29483 80.91.229.12 (30 May 2010 23:27:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 May 2010 23:27:55 +0000 (UTC) Cc: Juanma Barranquero To: Lennart Borgman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 31 01:27:51 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 1OIrv4-0006cd-Nh for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 May 2010 01:27:51 +0200 Original-Received: from localhost ([127.0.0.1]:58901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIrv3-0004QV-P6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 May 2010 19:27:49 -0400 Original-Received: from [140.186.70.92] (port=45724 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIrus-0004Nh-Mp for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 19:27:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OIrur-00053Q-Bw for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 19:27:38 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35035) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIrur-00053M-AQ for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 19:27:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OIrY1-0004aE-T8 for bug-gnu-emacs@gnu.org; Sun, 30 May 2010 19:04:01 -0400 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 May 2010 23:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 6299 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 6299@debbugs.gnu.org, monnier@iro.umontreal.ca Original-Received: via spool by 6299-done@debbugs.gnu.org id=D6299.127526064117611 (code D ref 6299); Sun, 30 May 2010 23:04:01 +0000 Original-Received: (at 6299-done) by debbugs.gnu.org; 30 May 2010 23:04:01 +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 1OIrXz-0004a0-Ts for submit@debbugs.gnu.org; Sun, 30 May 2010 19:04:00 -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 1OIpuR-0003t8-85 for 6299-done@debbugs.gnu.org; Sun, 30 May 2010 17:19:03 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAJtzAkxMCpdY/2dsb2JhbACeMXK/AoUWBINniGU X-IronPort-AV: E=Sophos;i="4.53,328,1272859200"; d="scan'208";a="66032053" 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 17:18:57 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 3577581F8; Sun, 30 May 2010 17:18:57 -0400 (EDT) In-Reply-To: (Lennart Borgman's message of "Sun, 30 May 2010 19:40:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Mailman-Approved-At: Sun, 30 May 2010 19:03:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 30 May 2010 19:04: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:37430 Archived-At: >> 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