I know that this is not exactly addressing what the OP asked, but a simple way to get ffap to do what you want is to give it just a little advice.
(defun delp--ffap-string-at-point-filter (s) "Remove long stretches of /////'s from `ffap-string-at-point' return value." (interactive "sTest string: ") (if (string-match-p "^//" s) "" s)) (advice-add 'ffap-string-at-point :filter-return 'delp--ffap-string-at-point-filter)
Edit: fixed incorrect lambda quote (#' => just ') I understand that modern emacsen prefer '# but the ones that do not prefer it, don't understand it.
For me, this worked. I really appreciated the insights of Kaushal Modi, Sigma, Chen bin, and Giles.
I use extended strings of ////'s to break up the page, and I am often in the header when trying to find either the current directory or a file therein. I know that this advice will not serve for all; I put it here because a search on ffap brought me here. Others might have different personal advice to provide the function. Based on what I read here, I wrote the code above.
I have been using Emacs since 1984, and some of the new features do not get on my radar until I see some code. I recommend the Info section on advice. Or in emacs (Info-goto-node "(elisp)Advising Functions").
C-x C-ftoffapor to a wrapper aroundffap?C-x C-f(byC-h kRETC-x C-f). It should say it "runs the command"find-file.find-file-at-pointfeature is disabled by default. I have it enabled viaido. I have(setq ido-use-filename-at-point 'guess)in my config.