1

When I invoke ffap on the file path that include whitespace, such as "/path/to/dir name/filename.txt", ffap.el stop searching file path before the "/path/to/dir" part.

I've checked the ffap.el, but there are many options and I couldn't find the appropriate configuration settings to change this behaviour, that trying to find proper file name beyond the whitespace character.

What is the best settings not to ignore whitespace when ffap trying to find the file name that include white space?

Drew
  • 75,699
  • 9
  • 109
  • 225
dualism
  • 304
  • 1
  • 6
  • Does your buffer, like your example, include double-quotes around the filename? If not, what rules are you proposing that ffap should use for determining potential filenames? – phils Apr 26 '18 at 05:17
  • For example, consider that the buffer contains the line `embedded somewhere in this text is the name of a file` and your file is named `in this text`. (Or even `where in this text`.) – phils Apr 26 '18 at 05:24

2 Answers2

2

There are very good odds that ffap is already doing something like what you'd like, but it's hidden from you. Try calling ffap on one of your filepaths; when it offers you only a partial result, hit C-i or TAB (one is an alias of the other). For me, I'm offered a set of completions that include the paths containing spaces.

"Use a different package" is seldom what folk hope to hear, but in this case, it might help. I use helm to view completions for most of my commands; when I call ffap on a file path with a space in the name, helm correctly shows me both a completion only up to the space, and completions past the space. This is a re-packaging of completion information already offered by ffap, but it's a lot easier to use and see.

This is not to say you should use helm -- it's excellent, but also a bit of a commitment. My main suggestion is: ffap is probably already doing what you want, but in a hard-to-use way; a better completion system could fix that.

Gastove
  • 1,511
  • 9
  • 15
0

Starting with Emacs-28 the following will do:

(setq ffap-file-name-with-spaces t)

Be aware that ffap is checking if the file or folder exists! So please don't check some arbitrary text..

I'm also recommending substituting some standard file bindings with

(ffap-bindings)

if you want the regularfind-file behaviour you can revert to the original behaviour with the universal argument C-u C-x C-f.

Dieter.Wilhelm
  • 1,836
  • 14
  • 25