I am using find-file-at-point and it stubbornly selects incorrect file name string in NXML mode:

String where I have cursor on the file name:


and when evaluating: (ffap-string-at-point) it selects ">my-file.ext</include".

Is there some simple way to tell ffap that '<' and '>' are NOT part of the file name?

Thanks, this is driving me crazy.

1 Answer 1


This behavior is based on ffap-string-at-point-mode-alist. Take a look at the current value and doc string.

You'll see an entry like this:

(file "--:\\\\${}+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")

The format here is (MODE CHARS BEG END) where CHARS are characters to include and BEG and END are characters to drop from the beginning and end. Notice that < and > are included as valid characters but also dropped at the beginning/end, which is why you're getting the seemingly odd match >my-file.ext</include.

One possible fix: add a new entry for XML files that does not include <> in the set of valid chars:

(add-to-list 'ffap-string-at-point-mode-alist
         '(nxml-mode "--:\\\\${}+@-Z_[:alpha:]~*?" "<@" "@>;.,!:"))
  • You are my hero for today! That was it! If I had more reputation points I would vote you up visibly! I hope somebody else will.
    – danny
    Nov 9, 2016 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.