Suppose I have a path like /path/to/file/
in the buffer. I'd like to put point over that path and invoke a command that will either open it if it exists or create it if it doesn't.
Edit 1 Thanks to @Drew for pointing out that /path/to/file/ ends with a slash. I meant /path/to/file which is a file, not a directory.
Also, in my case M-x ffap
on /tmp/non-existing-file
will wait for user input at the minibuffer with the following prompt Find file or URL: /tmp/
Edit 2
Here's what I tried
(defun ffap-create-file ()
"find or create file at point"
(interactive)
(setq filename (ffap-string-at-point))
(ffap filename))
This code works, but it doesn't prompt. The "usual" behavior of ffap is to prompt the user with the filename already populated in the minibuffer.