3

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:

<include>my-file.ext</include>

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.

3

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:]~*?" "<@" "@>;.,!:"))
| improve this answer | |
  • 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 '16 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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