[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BUG] org-link-search fails if search string contains new lines
From: |
Nicolas Goaziou |
Subject: |
Re: [O] [BUG] org-link-search fails if search string contains new lines |
Date: |
Mon, 27 Mar 2017 13:37:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hello,
Matt Lundin <address@hidden> writes:
> Matt Lundin <address@hidden> writes:
>
>>
>> Create an active region covering the third sentence and select the
>> org-capture "n" template, which creates the following link:
>>
>> * Test
>>
>> [[file:~/test.txt::Duis%20aute%20irure%20dolor%20in%0Areprehenderit%20in%20voluptate%20velit%20esse%20cillum%20dolore%20eu%20fugiat%20nulla%0Apariatur.]]
>>
>> Try to follow the link. It will open test.txt, but it will also give the
>> message and fail to locate the correct position in the file:
>>
>> "No match for fuzzy expression: Duis aute irure dolor in
>> reprehenderit in voluptate velit esse cillum dolore eu fugiat
>> nulla pariatur."
>>
>
> The problem, I think, is the regexp construction in org-link-search.
> This was introduced back in August of 2015 with commit
> cfe5bc97f8b18ccbf49d0764746c7563ce8d29da.
>
> The problematic line in org.el is 10951:
>
> (s-multi-re (mapconcat #'regexp-quote words "[ \t]+\\(?:\n[ \t]*\\)?"))
>
> The constructed regexp fails because it assumes a newline will be
> preceded by whitespace. But often newlines are not preceded by
> whitespace.
>
> Is there a reason the following won't work?
>
> (s-multi-re (mapconcat #'regexp-quote words "[ \t\r\n]+"))
>
> This was the method org-link-search used prior to the commit above. Are
> we trying to avoid matching across blank lines?
Yes, we are.
Fixed, hopefully.
Regards,
--
Nicolas Goaziou