From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: [PATCH] Allow insertion of links with multi-line search strings Date: Mon, 27 Mar 2017 10:02:47 -0500 Message-ID: <87vaquahk8.fsf@fastmail.fm> References: <87h92gx9ak.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/x-diff Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csWAY-0004QR-C5 for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 11:02:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csWAS-00014H-Pl for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 11:02:54 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42927) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csWAS-00013K-M3 for emacs-orgmode@gnu.org; Mon, 27 Mar 2017 11:02:48 -0400 Received: from archpad (c-24-14-63-242.hsd1.il.comcast.net [24.14.63.242]) by mail.messagingengine.com (Postfix) with ESMTPA id 91E637E352 for ; Mon, 27 Mar 2017 11:02:47 -0400 (EDT) In-Reply-To: <87h92gx9ak.fsf@fastmail.fm> (Matt Lundin's message of "Sun, 26 Mar 2017 12:21:32 -0500") Content-Disposition: inline; filename=0001-Allow-insertion-of-links-with-multi-line-search-stri.patch 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 >From 726eba76f31537747a26a7689ee632ec8e9bc01f Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Mon, 27 Mar 2017 09:55:33 -0500 Subject: [PATCH] Allow insertion of links with multi-line search strings * lisp/org.el: (org-insert-link): Fix regexps to match across newlines. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e40db18f6..dcfa4fd6f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10330,7 +10330,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support ;; option If yes, simplify the link by using only the search ;; option. (when (and buffer-file-name - (string-match "^file:\\(.+?\\)::\\(.+\\)" link)) + (string-match "^file:\\(.+?\\)::\\(\\(.\\|\n\\)+\\)" link)) (let* ((path (match-string 1 link)) (case-fold-search nil) (search (match-string 2 link))) @@ -10340,7 +10340,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq link search))))) ;; Check if we can/should use a relative path. If yes, simplify the link - (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link) + (when (string-match "^\\(file:\\|docview:\\)\\(\\(.\\|\n\\)*\\)" link) (let* ((type (match-string 1 link)) (path (match-string 2 link)) (origpath path) -- 2.12.1