From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: [BUG] org-link-search fails if search string contains new lines Date: Sun, 26 Mar 2017 15:50:30 -0500 Message-ID: <87inmvwynd.fsf@fastmail.fm> References: <87zig8vt48.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csF7U-0000lP-5w for emacs-orgmode@gnu.org; Sun, 26 Mar 2017 16:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csF7R-0003QD-3R for emacs-orgmode@gnu.org; Sun, 26 Mar 2017 16:50:36 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:53274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csF7Q-0003PR-FW for emacs-orgmode@gnu.org; Sun, 26 Mar 2017 16:50:33 -0400 Received: from archpad (unknown [104.200.153.81]) by mail.messagingengine.com (Postfix) with ESMTPA id 41E467E459 for ; Sun, 26 Mar 2017 16:50:31 -0400 (EDT) In-Reply-To: <87zig8vt48.fsf@fastmail.fm> (Matt Lundin's message of "Sun, 26 Mar 2017 12:35:19 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode Matt Lundin 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? Best, Matt