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'delp--ffap-string-at-point-filter) forEdit: 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").