From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] org-link-search fails if search string contains new lines Date: Mon, 27 Mar 2017 13:37:18 +0200 Message-ID: <87k27bj6hd.fsf@nicolasgoaziou.fr> References: <87zig8vt48.fsf@fastmail.fm> <87inmvwynd.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csSxg-0006Px-Tf for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 07:37:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csSxd-0000NA-1o for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 07:37:24 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:53748) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csSxc-0000My-RQ for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 07:37:20 -0400 Received: from saiph.selenimh (00004301000000000000074b.ipv6.commingeshautdebit.fr [IPv6:2a03:a0a0:0:4301::74b]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 64E22A86CC for ; Mon, 27 Mar 2017 13:37:19 +0200 (CEST) Received: from ngz by saiph.selenimh with local (Exim 4.88) (envelope-from ) id 1csSxa-0003EK-HQ for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 13:37:18 +0200 In-Reply-To: <87inmvwynd.fsf@fastmail.fm> (Matt Lundin's message of "Sun, 26 Mar 2017 15:50:30 -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 Hello, Matt Lundin writes: > 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? Yes, we are. Fixed, hopefully. Regards, -- Nicolas Goaziou