GNU bug report logs - #27267
25.1; ffap-file-at-point erroneously returns "" in some cases

Previous Next

Package: emacs;

Reported by: Alex <agrambot <at> gmail.com>

Date: Tue, 6 Jun 2017 22:44:01 UTC

Severity: minor

Found in version 25.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27267 in the body.
You can then email your comments to 27267 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#27267; Package emacs. (Tue, 06 Jun 2017 22:44:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex <agrambot <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 06 Jun 2017 22:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; ffap-file-at-point erroneously returns "" in some cases
Date: Tue, 06 Jun 2017 16:43:32 -0600
[Message part 1 (text/plain, inline)]
Execute ffap-file-at-point with the following buffer contents (| for
cursor position):

7:|

The result is "", which leads to ffap's default input being ~ (not ~/ as
expected).

Similarly, try ffap-file-at-point on:

:6|

This is due to ffap-file-at-point stripping off the colon and numbers,
and sending "" to ffap-file-exists-string. (file-exists-p "") returns t,
so ffap-file-at-point treats "" as an existent file.

The following diff fixes this, but I'm not sure if it's the best
approach. Perhaps ffap-file-at-point just checks that the argument to
ffap-file-exists-string is non-empty each time it's called.


[ffap2.diff (text/x-diff, inline)]
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 87531110b8..21312b34c3 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -514,6 +514,7 @@ ffap-file-exists-string
 The optional NOMODIFY argument suppresses the extra search."
   (cond
    ((not file) nil)			; quietly reject nil
+   ((string-empty-p file) nil)		; reject empty string
    ((file-exists-p file) file)		; try unmodified first
    ;; three reasons to suppress search:
    (nomodify nil)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27267; Package emacs. (Sun, 21 Jul 2019 17:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 27267 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alex <agrambot <at> gmail.com>
Cc: 27267 <at> debbugs.gnu.org
Subject: Re: bug#27267: 25.1; ffap-file-at-point erroneously returns "" in
 some cases
Date: Sun, 21 Jul 2019 19:48:43 +0200
Alex <agrambot <at> gmail.com> writes:

> Execute ffap-file-at-point with the following buffer contents (| for
> cursor position):
>
> 7:|
>
> The result is "", which leads to ffap's default input being ~ (not ~/ as
> expected).

I get

(ffap-file-at-point)
=> "/home/larsi/"

so this seems like it's fixed.

>
> Similarly, try ffap-file-at-point on:
>
> :6|
>
> This is due to ffap-file-at-point stripping off the colon and numbers,
> and sending "" to ffap-file-exists-string. (file-exists-p "") returns t,
> so ffap-file-at-point treats "" as an existent file.

I get nil from that in the Emacs trunk, which seems correct, so I guess
this has been fixed to, and I'm closing this bug report.  Please reopen
if this is still present on the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 27267 <at> debbugs.gnu.org and Alex <agrambot <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 21 Jul 2019 17:49:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Aug 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 248 days ago.

Previous Next


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