[Top][All Lists]

[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: Matt Lundin
Subject: Re: [O] [BUG] org-link-search fails if search string contains new lines
Date: Mon, 27 Mar 2017 10:15:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

>> 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.

Thanks Nicolas. Yes, it now works with multi-line searches that do not
contain blank lines.

I think there are some instances in which one might want to search
across blank lines, such as when one captures a region that contains one
or more blank lines. E.g., let's say org-context-in-file-links is t (the
default). If one captures a section in org.el containing a blank line,
org-link-search will fail to locate the section.

Here's a sample link to try it out. (It assumes an org-mode repository
at ~/org-mode).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]