From unknown Sat Aug 16 20:56:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#6299 <6299@debbugs.gnu.org> To: bug#6299 <6299@debbugs.gnu.org> Subject: Status: In read-file-name: (args-out-of-range "c:" 0 3) Reply-To: bug#6299 <6299@debbugs.gnu.org> Date: Sun, 17 Aug 2025 03:56:30 +0000 retitle 6299 In read-file-name: (args-out-of-range "c:" 0 3) reassign 6299 emacs submitter 6299 Lennart Borgman severity 6299 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri May 28 21:35:29 2010 Received: (at submit) by debbugs.gnu.org; 29 May 2010 01:35:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIAxV-0003Ms-0I for submit@debbugs.gnu.org; Fri, 28 May 2010 21:35:29 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIAxT-0003Mn-JM for submit@debbugs.gnu.org; Fri, 28 May 2010 21:35:28 -0400 Received: from lists.gnu.org ([199.232.76.165]:38583) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OIAxP-0004t1-Sg for submit@debbugs.gnu.org; Fri, 28 May 2010 21:35:23 -0400 Received: from [140.186.70.92] (port=47953 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OIAxO-0004yN-5t for bug-gnu-emacs@gnu.org; Fri, 28 May 2010 21:35:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OIAxN-0005ak-0u for bug-gnu-emacs@gnu.org; Fri, 28 May 2010 21:35:22 -0400 Received: from mail-yw0-f193.google.com ([209.85.211.193]:47285) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIAxM-0005ag-Up for bug-gnu-emacs@gnu.org; Fri, 28 May 2010 21:35:20 -0400 Received: by ywh31 with SMTP id 31so1482244ywh.24 for ; Fri, 28 May 2010 18:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=YsluwRo8AZUH/Zdb5m2PFY/1wVN/aqMQwLz/iBoxU6I=; b=SXFFO4yAam8ev2k+uJqOc5+FrrAhicRQhTsMcE82+REx3YW99XsJLGjCwyGVUhyt2u PZ+ti38USn+dZS/c87zW8Hs2f/gTuQsfizvh2glsvnscEnn8UvX4p3r9k5ChBKvhl7CH C+k+Rc9g9B2wAEHiuhAJueKUT4h2q4fdHwHn4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=HWilviL/j8mJAYeVfl3/e+kGy3Fezgz4zlPtYZKv3wONxsuqzj+xLAKwDISeHrSro2 cbEf1UdEJpzzSLNzZUiXnTi3gV8MULtGOuH1tlv6bWE8IjqUL9rvdLrtDF6YYsSMEY2y S+kxUVHacjljZEaYTSJJGB/J3l+zZqgjbsYbQ= Received: by 10.101.195.8 with SMTP id x8mr1425225anp.186.1275096920192; Fri, 28 May 2010 18:35:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.177.20 with HTTP; Fri, 28 May 2010 18:35:00 -0700 (PDT) From: Lennart Borgman Date: Sat, 29 May 2010 03:35:00 +0200 Message-ID: Subject: In read-file-name: (args-out-of-range "c:" 0 3) To: Emacs Bugs Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) 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) From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 12:12:35 2010 Received: (at 6299) by debbugs.gnu.org; 29 May 2010 16:12:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIOeI-0001Qx-KR for submit@debbugs.gnu.org; Sat, 29 May 2010 12:12:34 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIOeF-0001Qr-Hk for 6299@debbugs.gnu.org; Sat, 29 May 2010 12:12:32 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0L3600J00VECPA00@a-mtaout22.012.net.il> for 6299@debbugs.gnu.org; Sat, 29 May 2010 19:12:25 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.127.245.238]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L3600IQVVOOM850@a-mtaout22.012.net.il>; Sat, 29 May 2010 19:12:25 +0300 (IDT) Date: Sat, 29 May 2010 19:12:25 +0300 From: Eli Zaretskii Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) In-reply-to: X-012-Sender: halo1@inter.net.il To: Lennart Borgman Message-id: <83pr0eu1p2.fsf@gnu.org> References: X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > From: Lennart Borgman > Date: Sat, 29 May 2010 03:35:00 +0200 > Cc: > > 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 I would suggest to step through completion-emacs22-try-completion in Edebug. From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 17:18:23 2010 Received: (at 6299) by debbugs.gnu.org; 29 May 2010 21:18:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OITQE-0004oP-SU for submit@debbugs.gnu.org; Sat, 29 May 2010 17:18:23 -0400 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 1OITQC-0004oK-Dr for 6299@debbugs.gnu.org; Sat, 29 May 2010 17:18:21 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEALwgAUxMCpdY/2dsb2JhbACePHK8UoUWBIxM X-IronPort-AV: E=Sophos;i="4.53,324,1272859200"; d="scan'208";a="65990519" Received: from 76-10-151-88.dsl.teksavvy.com (HELO pastel.home) ([76.10.151.88]) by ironport2-out.pppoe.ca with ESMTP; 29 May 2010 17:18:15 -0400 Received: by pastel.home (Postfix, from userid 20848) id B174B81F8; Sat, 29 May 2010 17:18:15 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Message-ID: References: Date: Sat, 29 May 2010 17:18:15 -0400 In-Reply-To: (Lennart Borgman's message of "Sat, 29 May 2010 03:35:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.2 (--) > 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)) First thing: edit completion--some o as to replace condition-case with condition-case-no-debug. This way the error won't be delayed and you'll get a more precise backtrace. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 17:25:04 2010 Received: (at 6299) by debbugs.gnu.org; 29 May 2010 21:25:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OITWi-0004rT-EI for submit@debbugs.gnu.org; Sat, 29 May 2010 17:25:04 -0400 Received: from mail-gy0-f172.google.com ([209.85.160.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OITWf-0004r6-M5 for 6299@debbugs.gnu.org; Sat, 29 May 2010 17:25:02 -0400 Received: by gyh4 with SMTP id 4so1738088gyh.3 for <6299@debbugs.gnu.org>; Sat, 29 May 2010 14:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=TyiKDPotQzXqvx0vWbu9D0/mDMLE37Ili/YnpFZ72FE=; b=o12x0FROtyKZgcoRhojI78jFpzZ+ZpziaxNPYaIGz8HURkYtbZYOH27ZGPZpifyzgi uRoHx0bPayQC/uJ+aQi4JWU5rTOL6JesAmTTh0hYsvQgAHrrmxf/SohBGDjSt12ZrFrc qN4v8T6j9dQWYc5LQzXI7Fhh+xJshkeiNcAvw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=HiPR6gPRTVTUPUqxiTJSPz3Vak4ai19AYGY2Z1uXYUH8gJWok7fRaJAvTMdTP+2oxR eAxbADPbdKgSMNucsvh9WkKT0/SB41FnLrEXsQwmVVuF9X3Xd6YCqvRMyw+yU42D3w38 YLrywID+PlphXwV1PJItVFkuImni9bPjNCeJg= Received: by 10.100.246.26 with SMTP id t26mr2562773anh.112.1275168297234; Sat, 29 May 2010 14:24:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sat, 29 May 2010 14:24:37 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sat, 29 May 2010 23:24:37 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sat, May 29, 2010 at 11:18 PM, Stefan Monnier wrote: >> Debugger entered--Lisp error: (args-out-of-range "c:" 0 3) >> =C2=A0 signal(args-out-of-range ("c:" 0 3)) >> =C2=A0 completion--some(#[(style) " =C2=A0 =C2=A0 =C2=A0 =C2=A0\236A@\n = \f >> $\207" [style completion-styles-alist string table pred point] 5] >> (basic partial-completion emacs22)) > > First thing: edit completion--some o as to replace condition-case with > condition-case-no-debug. =C2=A0This way the error won't be delayed and yo= u'll > get a more precise backtrace. OK: Debugger entered--Lisp error: (args-out-of-range "c:" 0 3) completion-pcm--find-all-completions("c:" read-file-name-internal file-exists-p 2 completion-pcm--filename-try-filter) completion-pcm--find-all-completions("c:/em" read-file-name-internal file-exists-p 5 completion-pcm--filename-try-filter) completion-pcm-try-completion("c:/em" read-file-name-internal file-exists= -p 5) #[(style) " \236A@\n \f $\207" [style completion-styles-alist string table pred point] 5](partial-completion) funcall(#[(style) " \236A@\n \f $\207" [style completion-styles-alist string table pred point] 5] partial-completion) (setq res (funcall fun arg)) (progn (setq arg (pop xs)) (setq res (funcall fun arg))) (lambda nil (progn (setq arg ...) (setq res ...)))() funcall((lambda nil (progn (setq arg ...) (setq res ...)))) (if debug-on-error (funcall body) (condition-case err (funcall body) (error ... nil))) (let ((body ...)) (if debug-on-error (funcall body) (condition-case err ... ...))) (condition-case-no-debug err (progn (setq arg ...) (setq res ...)) (error (unless firsterror ... ...) nil)) (while (and (not res) xs) (condition-case-no-debug err (progn ... ...) (error ... nil))) (let ((firsterror nil) arg res) (while (and ... xs) (condition-case-no-debug err ... ...)) (or res (if firsterror ...))) completion--some(#[(style) " \236A@\n \f $\207" [style completion-styles-alist string table pred point] 5] (basic partial-completion emacs22)) completion-try-completion("c:/em" read-file-name-internal file-exists-p 5= ) 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/emacs/lisp/" file-name-history "c:/emacs/p/100522/emacs/lisp/") ad-Orig-read-file-name("Find file: " nil "c:/emacs/p/100522/emacs/lisp/" 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-v= alue) read-file-name("Find file: " nil "c:/emacs/p/100522/emacs/lisp/") (cons (read-file-name "Find file: " nil default-directory) (cond (... ...) (... ...))) call-interactively(find-file nil nil) From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 18:07:43 2010 Received: (at 6299) by debbugs.gnu.org; 29 May 2010 22:07:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIUBz-00059R-C2 for submit@debbugs.gnu.org; Sat, 29 May 2010 18:07:43 -0400 Received: from mail-yw0-f183.google.com ([209.85.211.183]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIUBw-00059M-MD for 6299@debbugs.gnu.org; Sat, 29 May 2010 18:07:41 -0400 Received: by ywh13 with SMTP id 13so1549903ywh.8 for <6299@debbugs.gnu.org>; Sat, 29 May 2010 15:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=tSNsC87MNy6yxxNWgbrewjE99M43hR2qlHyHpuBhAus=; b=GYiBQie2SqQ4Z+y37riJTlvZ7ahXy4VOKCLfh9Eq/HpL06k1uQ0ApYOTAIKh8NPrNL JQsB5l8/2vJDTm+F0Yys/wgsgzY91xNJAepje89g6FVH2cEPVchFZOcaeawjG1rdtbF8 XxlKbfDov9eDS1ZD/MiPeIB/hKAW2eFDGkk4k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=ew97J5tGJ5E9aV4wvhIbeCiP6mYywM6Td5zmdvGnkiYBMpQRPBq2rtR9Vbui46jdBF hXDYOMO1AygSMoDB+3ZySa1AWAZbaJwHXFzMiwOdvaAtP9+TWLr1lSH5mdyCKWUdyHOb 0nyYQRpybHyatC/9XxlNv06FRQKMrcdMPX40k= Received: by 10.101.151.26 with SMTP id d26mr2617924ano.190.1275170856115; Sat, 29 May 2010 15:07:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sat, 29 May 2010 15:07:16 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sun, 30 May 2010 00:07:16 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sat, May 29, 2010 at 11:24 PM, Lennart Borgman wrote: > On Sat, May 29, 2010 at 11:18 PM, Stefan Monnier > wrote: >>> Debugger entered--Lisp error: (args-out-of-range "c:" 0 3) >>> =C2=A0 signal(args-out-of-range ("c:" 0 3)) >>> =C2=A0 completion--some(#[(style) " =C2=A0 =C2=A0 =C2=A0 =C2=A0\236A@\n= \f >>> $\207" [style completion-styles-alist string table pred point] 5] >>> (basic partial-completion emacs22)) >> >> First thing: edit completion--some o as to replace condition-case with >> condition-case-no-debug. =C2=A0This way the error won't be delayed and y= ou'll >> get a more precise backtrace. eval-buffer in minibuffer.el made it more understandable. Here it is (but I do not know the cause of it): * I added a little trace here (defun completion-pcm--find-all-completions (string table pred point &optional filter) "Find all completions for STRING at POINT in TABLE, satisfying PRED. POINT is a position inside STRING. FILTER is a function applied to the return value, that can be used, e.g. to filter out additional entries (because TABLE migth not obey PRED)." (unless filter (setq filter 'identity)) (message "FIND: filter=3D%S" filter) (let* ((beforepoint (substring string 0 point)) (afterpoint (substring string point)) (bounds (completion-boundaries beforepoint table pred afterpoint)) (dummy (message "FIND: string=3D%S bounds=3D%S, beforepoint=3D%S afterpoint=3D%S" string bounds beforepoint afterpoint)) (prefix (substring beforepoint 0 (car bounds))) (suffix (substring afterpoint (cdr bounds))) firsterror) and in (defun completion-boundaries (string table pred suffix) "Return the boundaries of the completions returned by TABLE for STRING. STRING is the string on which completion will be performed. SUFFIX is the string after point. The result is of the form (START . END) where START is the position in STRING of the beginning of the completion field and END is the position in SUFFIX of the end of the completion field. E.g. for simple completion tables, the result is always (0 . (length SUFFIX= )) and for file names the result is the positions delimited by the closest directory separators." (message "BOUNDARIES string=3D%S table=3D%s pred=3D%s suffix=3D%S" string table pred suffix) (let ((boundaries (if (functionp table) (funcall table string pred (cons 'boundaries suffix= ))))) (message "BOUNDARIES boundaries=3D%S" boundaries) (if (not (eq (car-safe boundaries) 'boundaries)) (setq boundaries nil)) (cons (or (cadr boundaries) 0) (or (cddr boundaries) (length suffix))))) and got BOUNDARIES string=3D"c:/ema" table=3Dread-file-name-internal pred=3Dfile-exists-p suffix=3D"" BOUNDARIES boundaries=3D(boundaries 3) FIND: filter=3Dcompletion-pcm--filename-try-filter BOUNDARIES string=3D"c:/ema" table=3Dread-file-name-internal pred=3Dfile-exists-p suffix=3D"" BOUNDARIES boundaries=3D(boundaries 3) FIND: string=3D"c:/ema" bounds=3D(3 . 0), beforepoint=3D"c:/ema" afterpoint= =3D"" FIND: prefix=3D"c:/" FIND: substring=3D"c:" FIND: filter=3Dcompletion-pcm--filename-try-filter BOUNDARIES string=3D"c:" table=3Dread-file-name-internal pred=3Dfile-exists-p suffix=3D"" BOUNDARIES boundaries=3D(boundaries 3) FIND: string=3D"c:" bounds=3D(3 . 0), beforepoint=3D"c:" afterpoint=3D"" Entering debugger... It looks like perhaps read-file-name-internal gives the wrong information. PS: There is an advice on read-file-name is Around-advice `viper-suffix-advice': Tell `exit-minibuffer' to run `viper-file-add-suffix' as a hook. which does not seem to be involved (I unadvised read-file-name). From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 19:29:52 2010 Received: (at 6299) by debbugs.gnu.org; 29 May 2010 23:29:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIVTU-0005hw-Kl for submit@debbugs.gnu.org; Sat, 29 May 2010 19:29:52 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIVTR-0005hr-Vx for 6299@debbugs.gnu.org; Sat, 29 May 2010 19:29:50 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAJJAAUxMCpdY/2dsb2JhbACeO3K8KYUWBIxM X-IronPort-AV: E=Sophos;i="4.53,324,1272859200"; d="scan'208";a="65993571" Received: from 76-10-151-88.dsl.teksavvy.com (HELO pastel.home) ([76.10.151.88]) by ironport2-out.pppoe.ca with ESMTP; 29 May 2010 19:29:45 -0400 Received: by pastel.home (Postfix, from userid 20848) id 2206681F8; Sat, 29 May 2010 19:29:45 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Message-ID: References: Date: Sat, 29 May 2010 19:29:45 -0400 In-Reply-To: (Lennart Borgman's message of "Sun, 30 May 2010 00:07:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.2 (--) > BOUNDARIES string="c:" table=read-file-name-internal pred=file-exists-p suffix="" > BOUNDARIES boundaries=(boundaries 3) This appears to be the problem. (read-file-name-internal "c:" nil '(boundaries . "")) seems to return (boundaries 3 . 0). Since the code that does that is most likely the one in completion--file-name-table which does: (let ((start (length (file-name-directory string))) (end (string-match-p "/" (cdr action)))) (list* 'boundaries start end))) my guess is that (file-name-directory "c:") return "c:/". I guess we should just use (or (string-match "[^/]*\\'" string) 0) instead of (length (file-name-directory string)) but it has N^2 complexity :-( Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 20:11:07 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 00:11:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIW7O-0005yi-3u for submit@debbugs.gnu.org; Sat, 29 May 2010 20:11:07 -0400 Received: from mail-yw0-f183.google.com ([209.85.211.183]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIW7L-0005yM-SU for 6299@debbugs.gnu.org; Sat, 29 May 2010 20:11:04 -0400 Received: by ywh13 with SMTP id 13so1593178ywh.8 for <6299@debbugs.gnu.org>; Sat, 29 May 2010 17:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=jrH5smU/yL7Kfu/RHZVWQrupu8qgUBNsnzZ4LefwjfQ=; b=ZyJKlJDcM7FsCO5WCeYgTK9IheIZmZvfAPnoel4t/nWBJ38snTB6dDk7Lh2HdQuSXF J70HjMhD8BevUliXr21zEdMlsye8QuccOT2VRz/4QNnneCiN0IoH7Me9IEFWBBIlGVgp yP5ULVfJKx7i11Lqxke+QhkYC15MPNn0l3K0c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=lYltw1gB24mYlt/tUms0GpQMTNPMMPpACQWdHOAzlqzugWypUIDiFmZCACDSXy3pA+ C9RCXZAse5iKoQ6znx2/GLMfQIMrHv/kgVvSqQW9jWlVzh4cNzkPjv6ogBLBqnvqaiBn y2psx4Wi4R57X0V6OkWeD3zBU+V1uVpCvj6pw= Received: by 10.100.245.40 with SMTP id s40mr2898216anh.137.1275178258180; Sat, 29 May 2010 17:10:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sat, 29 May 2010 17:10:38 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sun, 30 May 2010 02:10:38 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sun, May 30, 2010 at 1:29 AM, Stefan Monnier wrote: >> BOUNDARIES string=3D"c:" table=3Dread-file-name-internal pred=3Dfile-exi= sts-p suffix=3D"" >> BOUNDARIES boundaries=3D(boundaries 3) > > This appears to be the problem. > > =C2=A0(read-file-name-internal "c:" nil '(boundaries . "")) > > seems to return (boundaries 3 . 0). > Since the code that does that is most likely the one in > completion--file-name-table which does: > > =C2=A0 =C2=A0(let ((start (length (file-name-directory string))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (string-match-p "/" (cdr action)))= ) > =C2=A0 =C2=A0 =C2=A0(list* 'boundaries start end))) > > my guess is that (file-name-directory "c:") return "c:/". Yes, that is the case, it returns "c:/". But I think that is can't return something. However in my opinion it should return an error because "c:" is not a file path. It is just a device. It it signaled an error code that tries something like this would be more easily found and cured. So I think the problem is that (file-name-directory "c:") is called. There must be some bad assumption somewhere in the code behind that. Another suggestion that might help cleaning the code logic in different places: Add a function directory-root-p w32: (directory-root-p "c:/") =3D> t *nix: (directory-root-p "/") =3D> t w32: (directory-root-p "/") =3D> nil (or signal error, but that would fit badly with file-directory-p) *nix: (directory-root-p "c;/") =3D> nil -"- > I guess we should just use (or (string-match "[^/]*\\'" string) 0) > instead of (length (file-name-directory string)) but it has N^2 > complexity :-( > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0Stefan > From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 23:34:15 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 03:34:15 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIZHx-0007IX-Uf for submit@debbugs.gnu.org; Sat, 29 May 2010 23:34:15 -0400 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 1OIZHw-0007IS-3l for 6299@debbugs.gnu.org; Sat, 29 May 2010 23:34:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAP55AUxMCpdY/2dsb2JhbACeO3K8I4UWBIxM X-IronPort-AV: E=Sophos;i="4.53,326,1272859200"; d="scan'208";a="65997986" Received: from 76-10-151-88.dsl.teksavvy.com (HELO pastel.home) ([76.10.151.88]) by ironport2-out.pppoe.ca with ESMTP; 29 May 2010 23:34:06 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9EE3881F8; Sat, 29 May 2010 23:34:06 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Message-ID: References: Date: Sat, 29 May 2010 23:34:06 -0400 In-Reply-To: (Lennart Borgman's message of "Sun, 30 May 2010 02:10:38 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.2 (--) >> my guess is that (file-name-directory "c:") return "c:/". > Yes, that is the case, it returns "c:/". What about (file-name-nondirectory "c:")? And what about (file-name-all-completions (file-name-nondirectory "c:") (file-name-directory "c:")) ? -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 00:27:28 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 04:27:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIa7U-0007cY-6s for submit@debbugs.gnu.org; Sun, 30 May 2010 00:27:28 -0400 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIa7R-0007cT-Gj for 6299@debbugs.gnu.org; Sun, 30 May 2010 00:27:26 -0400 Received: by fxm6 with SMTP id 6so1748449fxm.3 for <6299@debbugs.gnu.org>; Sat, 29 May 2010 21:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=kpIb8XGn9aSFDWiABMrR+nqAE2MQ9h8vKrzD5+jgKpo=; b=jcrVYmS1IGJppwiUR7Hhntopx0fXIIww/YTo7lGBu46t09s4B12HetQzjG31Av2RLu XvHVgmqFyNJpckF0AQOYToWKJZZgBZWMUUzjAv9nNZvjfteMZBPeBxrorXbs9+bbbyoP 0394EuJFUl+SAdHjzHqTMHCh56RpUcUojBtPg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=WQ775af/J5LUA4eNs8/zHG6eofv2jeW3nlxATB8KaIwq95cprwxRWp3DQd2449KuTX Ma6BPmAxu5MLeknkbE+u320AScXXY6WNP+eM9GPHxn7mc8ogOwlIH1uWLuWS1L/3QqM5 7hDvdITN6311C76HdsUgedkfdRAjoMxBt9NYc= Received: by 10.103.64.25 with SMTP id r25mr832766muk.68.1275193641145; Sat, 29 May 2010 21:27:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.32.18 with HTTP; Sat, 29 May 2010 21:27:01 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Sun, 30 May 2010 06:27:01 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org, Lennart Borgman X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) On Sun, May 30, 2010 at 05:34, Stefan Monnier wr= ote: > What about (file-name-nondirectory "c:")? ELISP> (file-name-nondirectory "c:") "" > And what about (file-name-all-completions > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file-name-nondire= ctory "c:") > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file-name-directo= ry "c:")) ? Returns all files and dirs in C:/ Juanma From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 06:12:16 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 10:12:16 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIfV9-0006fi-QE for submit@debbugs.gnu.org; Sun, 30 May 2010 06:12:16 -0400 Received: from mail-gy0-f172.google.com ([209.85.160.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIfV7-0006fS-6N for 6299@debbugs.gnu.org; Sun, 30 May 2010 06:12:13 -0400 Received: by gyh4 with SMTP id 4so1918373gyh.3 for <6299@debbugs.gnu.org>; Sun, 30 May 2010 03:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=GlpdnELo2AuiZNIwYlBohZOa/xrwJW+46vGNwMYJNHg=; b=lnxsfcRg48WHVrrJ+Ry7WG5Gz4JQGJoO1mIbGHutNKUBGVWzSCisJnAAmn+lRHRQn0 vCfsf0NrjmqFXYWD7bWIXfBCscs1Cx2tkjzD+sY4QuRqUiGxgj17+nYrrWZB8Caz4CLC SCH9Et3wZ8cq6UC4gRG35Lo5wzRGFtz1qyedE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=B0CnyFb1BdbyUzev+/ApczUAo/6xMSJmgU8+xUCTKYwTm2PLGwRrbJTOd5rGsmBbgi uAg6trYFq1R6ad7njaJExC6jdIsHqaakCO1jywPrClP3ObKuIAlP9mZTCNKvv/Ko0jAO MwIVUP0fa4WAHZmRrFvNU1/YLhHaQ+EIs4Voc= Received: by 10.101.106.1 with SMTP id i1mr3133823anm.240.1275214330283; Sun, 30 May 2010 03:12:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sun, 30 May 2010 03:11:50 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sun, 30 May 2010 12:11:50 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Juanma Barranquero Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sun, May 30, 2010 at 6:27 AM, Juanma Barranquero wrot= e: > On Sun, May 30, 2010 at 05:34, Stefan Monnier = wrote: > >> What about (file-name-nondirectory "c:")? > > ELISP> (file-name-nondirectory "c:") > "" Same here. >> And what about (file-name-all-completions >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file-name-nondir= ectory "c:") >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file-name-direct= ory "c:")) ? > > Returns all files and dirs in C:/ The same + tramp's symbols (fcp:, psftp:, plinkx: etc) and tramp's usernames ("some.one@" etc). From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 09:39:28 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 13:39:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIijg-0000id-24 for submit@debbugs.gnu.org; Sun, 30 May 2010 09:39:28 -0400 Received: from mail-gw0-f44.google.com ([74.125.83.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIijd-0000iW-Rc for 6299@debbugs.gnu.org; Sun, 30 May 2010 09:39:26 -0400 Received: by gwj19 with SMTP id 19so1968399gwj.3 for <6299@debbugs.gnu.org>; Sun, 30 May 2010 06:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=XFFVn+u9AnDmfqUXwrTsvfiFmNtSiXOZYbHD2ltwsrU=; b=s9SEwo00x55r87ilC9MBaAV3zlCHP9+Hfvj67sOQHldKx3aKVE11VKav3YgEUlYylZ a3mlnd9YL8YmPtdWoaMVMAAc8Bv6r15BaDEn5Uunze/J3J0XP4Ui29t1aOhPPPm0W8te wwvdniaeXz/R45wj9vSHdXdmar7keYm9FYSDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=LFc7hOVkq+lcBp0pAnrke0cFPlYmtFlaymJcUSEADi4QDciF1wVb1qseCmoTJovn+N /xck7zXKwY1CALFG/tfacgvBSwJfE4Ug9Y3cAWxkss1WCPoN6d2N5JOJ4sJf7+gXvnvF o7meikIiqZjhn5i36qn8RHtNta6PMXQ+qiKic= Received: by 10.100.245.4 with SMTP id s4mr3349500anh.224.1275226760189; Sun, 30 May 2010 06:39:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sun, 30 May 2010 06:39:00 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sun, 30 May 2010 15:39:00 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sun, May 30, 2010 at 2:10 AM, Lennart Borgman wrote: > On Sun, May 30, 2010 at 1:29 AM, Stefan Monnier > wrote: >>> BOUNDARIES string=3D"c:" table=3Dread-file-name-internal pred=3Dfile-ex= ists-p suffix=3D"" >>> BOUNDARIES boundaries=3D(boundaries 3) >> >> This appears to be the problem. >> >> =C2=A0(read-file-name-internal "c:" nil '(boundaries . "")) >> >> seems to return (boundaries 3 . 0). >> Since the code that does that is most likely the one in >> completion--file-name-table which does: >> >> =C2=A0 =C2=A0(let ((start (length (file-name-directory string))) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (string-match-p "/" (cdr action))= )) >> =C2=A0 =C2=A0 =C2=A0(list* 'boundaries start end))) >> >> my guess is that (file-name-directory "c:") return "c:/". > > Yes, that is the case, it returns "c:/". > > But I think that is can't return something. However in my opinion it > should return an error because "c:" is not a file path. It is just a > device. It it signaled an error code that tries something like this > would be more easily found and cured. > > So I think the problem is that (file-name-directory "c:") is called. > There must be some bad assumption somewhere in the code behind that. > > > Another suggestion that might help cleaning the code logic in > different places: Add a function directory-root-p > > w32: (directory-root-p "c:/") =3D> t > *nix: (directory-root-p "/") =3D> t > > w32: (directory-root-p "/") =3D> nil (or signal error, but that would > fit badly with file-directory-p) > *nix: (directory-root-p "c;/") =3D> nil -"- I am looking around at the code a bit. I do not understand the comment in completion--file-name-table: (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 ;; `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'. AFAICS it is doing exactly the same as completion-file-name-table here. What am I missing? BTW the doc string for action in completing read etc should be fixed. >> I guess we should just use (or (string-match "[^/]*\\'" string) 0) >> instead of (length (file-name-directory string)) but it has N^2 >> complexity :-( >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0Stefan >> > From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 10:05:58 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 14:05:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIj9K-0000uG-0I for submit@debbugs.gnu.org; Sun, 30 May 2010 10:05:58 -0400 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 1OIj9H-0000uA-EL for 6299@debbugs.gnu.org; Sun, 30 May 2010 10:05:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAKYNAkxMCpdY/2dsb2JhbACeNHK9R4UWBIxM X-IronPort-AV: E=Sophos;i="4.53,327,1272859200"; d="scan'208";a="66008551" 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:05:49 -0400 Received: by pastel.home (Postfix, from userid 20848) id 42C9481F8; Sun, 30 May 2010 10:05:49 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Message-ID: References: Date: Sun, 30 May 2010 10:05:49 -0400 In-Reply-To: (Lennart Borgman's message of "Sun, 30 May 2010 15:39:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.2 (--) > I am looking around at the code a bit. I do not understand the comment > in completion--file-name-table: > (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 > ;; `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'. > AFAICS it is doing exactly the same as completion-file-name-table > here. What am I missing? You're missing that "delegate to completion-file-name-table" means calling substitute-in-file-name first and then completion-file-name-table, so it wouldn't do the same. But yes, we could call completion-file-name-table directly without going through substitute-in-file-name. The reason why I don't do that is mostly historical (I first started to do something more clever which didn't work). > BTW the doc string for action in completing read etc should be fixed. I don't know what you mean here. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 10:19:03 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 14:19:04 +0000 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 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" 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 Received: by pastel.home (Postfix, from userid 20848) id 6571181F8; Sun, 30 May 2010 10:18:44 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Message-ID: References: Date: Sun, 30 May 2010 10:18:44 -0400 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) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.2 (--) X-Debbugs-Envelope-To: 6299 Cc: Juanma Barranquero , 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.2 (--) >>> 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 From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 13:40:10 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 17:40:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OImUc-0002N6-Jr for submit@debbugs.gnu.org; Sun, 30 May 2010 13:40:10 -0400 Received: from mail-gy0-f172.google.com ([209.85.160.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OImUa-0002N1-8C for 6299@debbugs.gnu.org; Sun, 30 May 2010 13:40:08 -0400 Received: by gyh4 with SMTP id 4so2050796gyh.3 for <6299@debbugs.gnu.org>; Sun, 30 May 2010 10:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=S0Fo/dXVD37LJI7+gp2lTjZTQKFh9J3loPLbiawllhU=; b=p+TXBRjks8/YmT1Mom0XEyTVhFktlP0Hyp3NGW9NiMT1l1tf4FReiY9RjdrPya2Nfa oBkS8bUU+S70Aop8w5EbLHoX47LAshNLQPTFRn117cbRAJlmFuVt9JSggot7fmUBle/T 7CwgDrsrKHD4qr1yzRUqcIw7NrfblcoZ/Gyuo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=jBaVYTHkNYl2P1IazpX6nQPVgiwtA6ldLRqC13PpzcSvcoOGTdSokgFiflutYlIqjh NZZ9OiH1irIY8UJDndN91nRrviXVef8v2hf17fjaBQz6oXCdyn6p2bNciYgQiJgT+sWJ MSt1Q7jmY8LqHxW89GYauwl3GguYe5UtlxlO8= Received: by 10.101.28.39 with SMTP id f39mr3616015anj.69.1275241203350; Sun, 30 May 2010 10:40:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sun, 30 May 2010 10:39:42 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sun, 30 May 2010 19:39:42 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sun, May 30, 2010 at 4:05 PM, Stefan Monnier wrote: > > You're missing that "delegate to completion-file-name-table" means No, but I saw in the patch that you understood what I mean. Excuse my bad explanation, I was just convinced that you should see it. >> BTW the doc string for action in completing read etc should be fixed. > > I don't know what you mean here. I meant the argument ACTION to some function, but what exactly was I reading?? Note that my current checkout is from 2010-05-22. Here are some doc strings which makes me confused: (defun completion-table-with-predicate (table pred1 strict string pred2 action) "Make a completion table equivalent to TABLE but filtered through PRED1. PRED1 is a function of one argument which returns non-nil if and only if the argument is an element of TABLE which should be considered for completion. STRING, PRED2, and ACTION are the usual arguments to completion tables, as described in `try-completion', `all-completions', and `test-completion'. If STRICT is t, the predicate always applies; if nil it only applies if it does not reduce the set of possible completions to nothing. Note: TABLE needs to be a proper completion table which obeys predicates." There is no ACTION arg to try-completion etc. (defun complete-with-action (action table string pred) "Perform completion ACTION. STRING is the string to complete. TABLE is the completion table, which should not be a function. PRED is a completion predicate. ACTION can be one of nil, t or `lambda'." It looks like ACTION is tested against n and t but not against lambda. And I think it can have other values, since the code seems to expect something like '(boundaries ...) ... From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 13:41:05 2010 Received: (at 6299) by debbugs.gnu.org; 30 May 2010 17:41:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OImVU-0002Nh-UV for submit@debbugs.gnu.org; Sun, 30 May 2010 13:41:05 -0400 Received: from mail-gw0-f44.google.com ([74.125.83.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OImVT-0002NI-Tw for 6299@debbugs.gnu.org; Sun, 30 May 2010 13:41:04 -0400 Received: by gwj19 with SMTP id 19so2051622gwj.3 for <6299@debbugs.gnu.org>; Sun, 30 May 2010 10:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=9B0fUxn+76s6Tj5wFxxqxNppnv1yd4RGhUPq+hln6d8=; b=JEPnvGMbQhh8a8E/bnQwepHhcI61sW3Y1N/bqJLxWMdSWzfoR1kpuLuj+97NNgaZab iQoqT13t07VYYv0AyPX0LuZ8uXYSZqC+qAOV+6PvDUz5XX0Z1wMAdyjG7HpwLajVGj3h t/aMgCd7QUvIunQzk9hNq7wdoIuajsOlv4sTg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=RfHbQQu2u3TV9wtjUmt+i4L+d2ZjvtZyjLXHWVkh7geGJzcpBBYq67L5DfjHu2aOdO LVQz2XkkUzDK5ofU+GoHGvQ/nDQLdQn9yjmdj4mEoKc6KPBcg9eCC9lYlNkkJwuAIo6/ iHZoJCA6g59r1egjWa5sm7QRUZPdPbB3lELl4= Received: by 10.101.10.7 with SMTP id n7mr3199063ani.94.1275241259082; Sun, 30 May 2010 10:40:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.44.20 with HTTP; Sun, 30 May 2010 10:40:39 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Sun, 30 May 2010 19:40:39 +0200 Message-ID: Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 6299 Cc: Juanma Barranquero , 6299@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) On Sun, May 30, 2010 at 4:18 PM, Stefan Monnier wrote: > >> 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. Yes, it seems to be separate. > I've installed the patch below which should hopefully fix the original problem. > Please confirm. Thanks, it works. From debbugs-submit-bounces@debbugs.gnu.org Sun May 30 19:04:00 2010 Received: (at 6299-done) by debbugs.gnu.org; 30 May 2010 23:04:01 +0000 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 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" 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 Received: by pastel.home (Postfix, from userid 20848) id 3577581F8; Sun, 30 May 2010 17:18:57 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#6299: In read-file-name: (args-out-of-range "c:" 0 3) Message-ID: References: Date: Sun, 30 May 2010 17:18:57 -0400 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) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 6299-done X-Mailman-Approved-At: Sun, 30 May 2010 19:03:58 -0400 Cc: Juanma Barranquero X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.2 (--) >> 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 From unknown Sat Aug 16 20:56:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 28 Jun 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator