From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: doc patch: move footnote in external links Date: Sat, 10 Jan 2015 13:45:49 +0100 Message-ID: References: <87egs4bwuu.fsf@nicolasgoaziou.fr> <87388jab2j.fsf@nicolasgoaziou.fr> <87y4q745w7.fsf@nicolasgoaziou.fr> <87vbl6x91a.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9vQP-0007Uj-6N for emacs-orgmode@gnu.org; Sat, 10 Jan 2015 07:45:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9vQK-00008k-4v for emacs-orgmode@gnu.org; Sat, 10 Jan 2015 07:45:53 -0500 Received: from mx1.polytechnique.org ([129.104.30.34]:41550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9vQJ-00008e-Qx for emacs-orgmode@gnu.org; Sat, 10 Jan 2015 07:45:48 -0500 Received: from top.local (unknown [37.162.47.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 0FCD41408EEE2 for ; Sat, 10 Jan 2015 13:45:46 +0100 (CET) In-Reply-To: <87vbl6x91a.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Sat, 20 Dec 2014 23:15:29 +0100") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sorry for the delay in answering =E2=80=A6 On 2014-12-20 23:15, Nicolas Goaziou writes: >> -file:projects.org::*task title @r{heading search in Org file} >> +file:projects.org::*task title @r{heading search in Org file= }@footnote{ >> +Headline searches always match the exact headline. If the headline is n= ot > ^^^ > two spaces > > It looks good. Here is an updated patch. I can push it or not, depending on the issue below. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Function-org-link-search-does-exact-headline-search.patch Content-Transfer-Encoding: quoted-printable From=207fa07604c85a6a5dd06a198232ae65c4f5c0272f Mon Sep 17 00:00:00 2001 From: Alan Schmitt Date: Fri, 12 Dec 2014 08:26:05 +0100 Subject: [PATCH] Function `org-link-search' does exact headline search * lisp/org.el (org-link-search): Change headline search such that it always does an exact search. * doc/org.texi (External links): Cleanup footnote about the `org-link-search-must-match-exact-headline' option for text searches and add a footnote about the effect of the same option for heading searches. =2D-- doc/org.texi | 7 +++++-- lisp/org.el | 27 +++++++-------------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 54b6fe9..a179250 100644 =2D-- a/doc/org.texi +++ b/doc/org.texi @@ -3561,10 +3561,13 @@ file:projects.org::some words @r{text s= earch in Org file}@footnote{ The actual behavior of the search will depend on the value of the option @code{org-link-search-must-match-exact-headline}. If its value is @code{nil}, then a fuzzy text search will be done. If it is t, then on= ly the =2Dexact headline will be matched. If the value is @code{'query-to-create}, +exact headline will be matched. If the value is @code{query-to-create}, then an exact headline will be searched; if it is not found, then the user will be queried to create it.} =2Dfile:projects.org::*task title @r{heading search in Org file} +file:projects.org::*task title @r{heading search in Org file}@f= ootnote{ +Headline searches always match the exact headline. If the headline is not +found and the value of the option @code{org-link-search-must-match-exact-h= eadline} +is @code{query-to-create}, then the user will be queried to create it.} file+sys:/path/to/file @r{open via OS, like double-clic= k} file+emacs:/path/to/file @r{force opening by Emacs} docview:papers/last.pdf::NNN @r{open in doc-view mode at page} diff --git a/lisp/org.el b/lisp/org.el index e8e3356..4ed1f17 100755 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -11021,8 +11021,7 @@ visibility around point, thus ignoring org-emphasis-alist) "\\|") "\\)")) (pos (point)) =2D (pre nil) (post nil) =2D words re0 re1 re2 re3 re4_ re4 re5 re2a re2a_ reall) + words re0 re2 re4_ re4 re5 re2a re2a_ reall) (cond ;; First check if there are any special search functions ((run-hook-with-args-until-success 'org-execute-file-search-functions= s)) @@ -11076,8 +11075,9 @@ visibility around point, thus ignoring ((derived-mode-p 'org-mode) (org-occur (match-string 1 s))) (t (org-do-occur (match-string 1 s))))) =2D ((and (derived-mode-p 'org-mode) org-link-search-must-match-exact-h= eadline) =2D (and (equal (string-to-char s) ?*) (setq s (substring s 1))) + ((and (derived-mode-p 'org-mode) + (or (and (equal (string-to-char s) ?*) (setq s (substring s 1))) + org-link-search-must-match-exact-headline)) (goto-char (point-min)) (cond ((let (case-fold-search) @@ -11099,11 +11099,6 @@ visibility around point, thus ignoring (error "No match")))) (t ;; A normal search string =2D (when (equal (string-to-char s) ?*) =2D ;; Anchor on headlines, post may include tags. =2D (setq pre "^\\*+[ \t]+\\(?:\\sw+\\)?[ \t]*" =2D post (org-re "[ \t]*\\(?:[ \t]+:[[:alnum:]_@#%:+]:[ \t]*\\)?$") =2D s (substring s 1))) (remove-text-properties 0 (length s) '(face nil mouse-face nil keymap nil fontified nil) s) @@ -11120,15 +11115,9 @@ visibility around point, thus ignoring "[^a-zA-Z_\r\n]+") "\\)[^a-zA-Z_]") re4 (concat "[^a-zA-Z_]" re4_) =20 =2D re1 (concat pre re2 post) =2D re3 (concat pre (if pre re4_ re4) post) =2D re5 (concat pre ".*" re4) =2D re2 (concat pre re2) =2D re2a (concat pre (if pre re2a_ re2a)) =2D re4 (concat pre (if pre re4_ re4)) =2D reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 =2D "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" =2D re5 "\\)")) + re5 (concat ".*" re4) + reall (concat "\\(" re0 "\\)\\|\\(" re2 "\\)\\|\\(" re4 + "\\)\\|\\(" re5 "\\)")) (cond ((eq type 'org-occur) (org-occur reall)) ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup)) @@ -11136,10 +11125,8 @@ visibility around point, thus ignoring (setq type 'fuzzy) (if (or (and (org-search-not-self 1 re0 nil t) (setq type 'dedicated)) =2D (org-search-not-self 1 re1 nil t) (org-search-not-self 1 re2 nil t) (org-search-not-self 1 re2a nil t) =2D (org-search-not-self 1 re3 nil t) (org-search-not-self 1 re4 nil t) (org-search-not-self 1 re5 nil t)) (goto-char (match-beginning 1)) =2D-=20 2.2.1 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > However, there is a small discrepancy between `org-link-search' and > `org-export-resolve-fuzzy-link' ("ox.el"). In the latter, matches > against headlines ignore white spaces between words. I think it should > be fixed either way (removing the feature in "ox.el" or adding it in > "org.el") at some point. I have looked at the code and it works *very* differently. I think I can make the `org-export-resolve-fuzzy-link' take spaces into accounts for headlines, but I don't see how it is "fuzzy". > Also, would you mind adding a test in test-org/fuzzy-links > ("test-org.el") and an entry in ORG-NEWS? I guess this should be done if I change `org-export-resolve-fuzzy-link', or should I do it anyway? Best, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBCgAGBQJUsR79AAoJEAQNCjtO0uXHG88H/1lrqxhKGOkSHVoLZ/2kVN5W WYN0RcgRiVBL61QW7tAc/lzhpzcR4tL9VpjG0XWWJH33hBI+g9rzdztAOPl7OS3c PfAFh68XNqTLExJ2PDkgmdn8kXtHQunEYLb5LbIPJYS7RQ3h/o5rRygFC+EoLpxP YIj7b63dz4+LElqgX+Heej4PwG2tClZyIF/Y2ELSsm7KlhBtCU/bt4cJDl1Yu1lE 0fhninzuUlae8LtDixbrBi8i3q/NV5yaiFkaV82itHiBPgCQOE/RnOADDSBx4+uW wDQtlvfCEHyBYRnR9kEsCYZPCyYClEpRDw9v5jhUdx8wYp/hdPdI9OyoE7CqPUI= =B93g -----END PGP SIGNATURE----- --==-=-=--