From unknown Sat Sep 06 04:31:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16648: [PATCH] Improved ffap-completable Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Feb 2014 07:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 16648@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13915845046513 (code B ref -1); Wed, 05 Feb 2014 07:16:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2014 07:15:04 +0000 Received: from localhost ([127.0.0.1]:50074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WAwhM-0001gz-8m for submit@debbugs.gnu.org; Wed, 05 Feb 2014 02:15:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52037) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WAwhJ-0001gJ-2n for submit@debbugs.gnu.org; Wed, 05 Feb 2014 02:15:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAwhA-0002q4-Gf for submit@debbugs.gnu.org; Wed, 05 Feb 2014 02:15:00 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAwhA-0002q0-DZ for submit@debbugs.gnu.org; Wed, 05 Feb 2014 02:14:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAwh1-0002Fm-Ul for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2014 02:14:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAwgp-0002o7-W2 for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2014 02:14:43 -0500 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:45209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAwgp-0002o1-Oq for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2014 02:14:31 -0500 Received: by mail-wg0-f54.google.com with SMTP id x13so1858wgg.9 for ; Tue, 04 Feb 2014 23:14:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:from:to:subject:date:message-id:mime-version :content-type; bh=ArYYQk2AvwxBynzRC247Iq8zdNoIAf9Y49hFqPC7o9k=; b=McFnLZYlm3PPK8agjU8P7iUBBmc213Ci5qR4sFqQJnGoNUAUWSAoB9+9t/tyaL9m4O YWVicGcZQETY6ERZZvkRNeQBhQlbSOD6AkzZKiNatHsA+SZ6lqgP9rPf/KdE11vuPr5Q h6tvQNDjx/89c2Y045B6ily2zrBPxjdQBng03cDWZXN0LCbjfV0IFdZtNplgx9TwSXbG 4BP6jwpr/kGuoe5qDhg6HWM9dtDIo/8y8AoN64l7PZ1yU9swuSj92MNT831TQGXW+en9 FI/Z2/6+rwzsE/UAnNfSW+aSSkGCO/1jfH05Z8sl6N5tAxMoM5F9cx6cKQauA+HrVJ0p ISlg== X-Received: by 10.180.19.69 with SMTP id c5mr1188384wie.7.1391584470841; Tue, 04 Feb 2014 23:14:30 -0800 (PST) Received: from ubuntu ([2.125.179.120]) by mx.google.com with ESMTPSA id ju6sm58974060wjc.1.2014.02.04.23.14.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Feb 2014 23:14:30 -0800 (PST) User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.1 From: E Sabof Date: Wed, 05 Feb 2014 07:14:28 +0000 Message-ID: <87txcef2uj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Assuming that point is at the word "The", and the complete filename follows. The current version will work when the default-directory contains one file "The first file.txt". But it won't if there is another file "The second file.txt", since file-name-completion will only give a partial completion. Evgeni diff --git a/lisp/ffap.el b/lisp/ffap.el index bb0f61d..4655639 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -819,8 +819,28 @@ URL, or nil. If nil, search the alist for further matches.") (defun ffap-completable (name) (let* ((dir (or (file-name-directory name) default-directory)) - (cmp (file-name-completion (file-name-nondirectory name) dir))) - (and cmp (concat dir cmp)))) + (completions (file-name-all-completions + (file-name-nondirectory name) dir)) + (looking-at-candidate + (lambda (candidate) + (string-equal (buffer-substring + (point) + (min (+ (point) (length candidate)) + (point-max))) + candidate))) + start) + (when (and completions (cdr completions)) + (setq completions + (or (cl-remove-if-not looking-at-candidate + completions) + (and (setq start (car (bounds-of-thing-at-point 'symbol))) + (/= start (point)) + (save-excursion + (goto-char start) + (cl-remove-if-not looking-at-candidate + completions)))))) + (when completions + (concat dir (car completions))))) (defun ffap-home (name) (ffap-locate-file name t '("~"))) From unknown Sat Sep 06 04:31:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16648: [PATCH] Improved ffap-completable Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Feb 2016 03:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: E Sabof Cc: 16648@debbugs.gnu.org Received: via spool by 16648-submit@debbugs.gnu.org id=B16648.145628426423300 (code B ref 16648); Wed, 24 Feb 2016 03:25:02 +0000 Received: (at 16648) by debbugs.gnu.org; 24 Feb 2016 03:24:24 +0000 Received: from localhost ([127.0.0.1]:42008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYQ3s-00063j-8b for submit@debbugs.gnu.org; Tue, 23 Feb 2016 22:24:24 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:58335) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYQ3q-00063b-J1 for 16648@debbugs.gnu.org; Tue, 23 Feb 2016 22:24:22 -0500 Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYQ3S-00071H-Es; Wed, 24 Feb 2016 04:23:59 +0100 From: Lars Ingebrigtsen References: <87txcef2uj.fsf@gmail.com> Date: Wed, 24 Feb 2016 14:23:54 +1100 In-Reply-To: <87txcef2uj.fsf@gmail.com> (E. Sabof's message of "Wed, 05 Feb 2014 07:14:28 +0000") Message-ID: <874mcyn645.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1aYQ3S-00071H-Es X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1456889039.25865@H5ZSJI95AAeZvyP/iCgpLw X-Spam-Status: No X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) E Sabof writes: > Assuming that point is at the word "The", and the complete filename > follows. The current version will work when the default-directory > contains one file "The first file.txt". But it won't if there is > another file "The second file.txt", since file-name-completion will > only give a partial completion. I think the patch below looks reasonable, but I rarely use ffap, so I'm not quite sure. Anybody have an opinion? Also, this patch is more than 15 lines, so we need FSF copyright assignment papers before applying it. Would you be willing so sign such papers? > > diff --git a/lisp/ffap.el b/lisp/ffap.el > index bb0f61d..4655639 100644 > --- a/lisp/ffap.el > +++ b/lisp/ffap.el > @@ -819,8 +819,28 @@ URL, or nil. If nil, search the alist for further matches.") > > (defun ffap-completable (name) > (let* ((dir (or (file-name-directory name) default-directory)) > - (cmp (file-name-completion (file-name-nondirectory name) dir))) > - (and cmp (concat dir cmp)))) > + (completions (file-name-all-completions > + (file-name-nondirectory name) dir)) > + (looking-at-candidate > + (lambda (candidate) > + (string-equal (buffer-substring > + (point) > + (min (+ (point) (length candidate)) > + (point-max))) > + candidate))) > + start) > + (when (and completions (cdr completions)) > + (setq completions > + (or (cl-remove-if-not looking-at-candidate > + completions) > + (and (setq start (car (bounds-of-thing-at-point 'symbol))) > + (/= start (point)) > + (save-excursion > + (goto-char start) > + (cl-remove-if-not looking-at-candidate > + completions)))))) > + (when completions > + (concat dir (car completions))))) > > (defun ffap-home (name) (ffap-locate-file name t '("~"))) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Sat Sep 06 04:31:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16648: [PATCH] Improved ffap-completable Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jun 2019 14:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: E Sabof Cc: 16648@debbugs.gnu.org Received: via spool by 16648-submit@debbugs.gnu.org id=B16648.156156030028687 (code B ref 16648); Wed, 26 Jun 2019 14:45:01 +0000 Received: (at 16648) by debbugs.gnu.org; 26 Jun 2019 14:45:00 +0000 Received: from localhost ([127.0.0.1]:36710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hg9AR-0007Sd-L9 for submit@debbugs.gnu.org; Wed, 26 Jun 2019 10:44:59 -0400 Received: from quimby.gnus.org ([80.91.231.51]:50082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hg9AP-0007ST-JH for 16648@debbugs.gnu.org; Wed, 26 Jun 2019 10:44:57 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hg9AK-0000qp-R0; Wed, 26 Jun 2019 16:44:56 +0200 From: Lars Ingebrigtsen References: <87txcef2uj.fsf@gmail.com> <874mcyn645.fsf@gnus.org> Date: Wed, 26 Jun 2019 16:44:52 +0200 In-Reply-To: <874mcyn645.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 24 Feb 2016 14:23:54 +1100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > Also, this patch is more than 15 lines, so we need FSF copyright > assignment papers before applying it. Would you be willing so sign such > papers? This was asked three years ago about a two year old patch, so I don't think there's going to be any progress here, and I'm closing the bug report. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > Also, this patch is more than 15 lines, so we need FSF copyright > assignment papers before applying it. Would you be willing so sign such > papers? This was asked three years ago about a two year old patch, so I don't think there's going to be any progress here, and I'm closing the bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 26 10:45:06 2019 Received: (at control) by debbugs.gnu.org; 26 Jun 2019 14:45:06 +0000 Received: from localhost ([127.0.0.1]:36715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hg9AX-0007WU-VQ for submit@debbugs.gnu.org; Wed, 26 Jun 2019 10:45:06 -0400 Received: from quimby.gnus.org ([80.91.231.51]:50096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hg9AU-0007TI-IU for control@debbugs.gnu.org; Wed, 26 Jun 2019 10:45:05 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hg9AR-0000qy-Vp for control@debbugs.gnu.org; Wed, 26 Jun 2019 16:45:01 +0200 Date: Wed, 26 Jun 2019 16:44:59 +0200 Message-Id: To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #16648 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 16648 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 16648 quit