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.

Drew
  • 75,699
  • 9
  • 109
  • 225
danny
  • 33
  • 3

1 Answers1

4

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:]~*?" "<@" "@>;.,!:"))
glucas
  • 20,175
  • 1
  • 51
  • 83
  • 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 09 '16 at 17:05