all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27267: 25.1; ffap-file-at-point erroneously returns "" in some cases
@ 2017-06-06 22:43 Alex
  2019-07-21 17:48 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Alex @ 2017-06-06 22:43 UTC (permalink / raw)
  To: 27267

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

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.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ffap --]
[-- Type: text/x-diff, Size: 445 bytes --]

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)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-21 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-06 22:43 bug#27267: 25.1; ffap-file-at-point erroneously returns "" in some cases Alex
2019-07-21 17:48 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.