From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: doc patch: move footnote in external links Date: Mon, 12 Jan 2015 12:12:21 +0100 Message-ID: References: <87egs4bwuu.fsf@nicolasgoaziou.fr> <87388jab2j.fsf@nicolasgoaziou.fr> <87y4q745w7.fsf@nicolasgoaziou.fr> <87vbl6x91a.fsf@nicolasgoaziou.fr> <87twzxdlkf.fsf@nicolasgoaziou.fr> <87lhl8e6db.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]:39174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAcv4-00043m-Fc for emacs-orgmode@gnu.org; Mon, 12 Jan 2015 06:12:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAcv0-0006ze-Em for emacs-orgmode@gnu.org; Mon, 12 Jan 2015 06:12:26 -0500 Received: from mx1.polytechnique.org ([129.104.30.34]:49983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAcv0-0006zV-5z for emacs-orgmode@gnu.org; Mon, 12 Jan 2015 06:12:22 -0500 Received: from top.local (charm-ecran.irisa.fr [131.254.101.83]) (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 B42B414000640 for ; Mon, 12 Jan 2015 12:12:20 +0100 (CET) In-Reply-To: <87lhl8e6db.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Mon, 12 Jan 2015 09:43:44 +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: text/plain Content-Transfer-Encoding: quoted-printable On 2015-01-12 09:43, Nicolas Goaziou writes: > Alan Schmitt writes: > >> I don't understand: won't you need the "[33%]" bit for an exact >> search? > > A statistics cookie is a variable part. If it ever changes, all your > links become invalid. It is better to simply ignore them (which is > already the case). OK. I see that the current regexp for headline matching is defined as follows: #+begin_src emacs-lisp (concat "^\\(\\*+\\)" "\\(?: +" org-todo-regexp "\\)?" "\\(?: +\\(\\[#.\\]\\)\\)?" "\\(?: +" ;; Stats cookies can be stuck to body. "\\(?:\\[[0-9%%/]+\\] *\\)*" "\\(%s\\)" "\\(?: *\\[[0-9%%/]+\\]\\)*" "\\)" (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") "[ \t]*$") #+end_src used like this (the regexp is `org-complex-heading-regexp-format'): #+begin_src emacs-lisp (re-search-forward (format org-complex-heading-regexp-format (regexp-quote s)) nil t) #+end_src I see that the cookie is ignored, but it seems that it can only be at the end of the searched heading. The approach taken in ox.el is different: it gets rid of the cookie in the found headlines: #+begin_src emacs-lisp (org-element-map data 'headline (lambda (headline) (when (equal (org-split-string (replace-regexp-in-string "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" "" (org-element-property :raw-value headline))) name) headline)) info 'first-match) #+end_src This allows the cookie to be anywhere (in fact not even surrounded by white space). Should we assume the cookie is at the end of the headline or not? >> Also, does ignoring whitespace mean replacing any (non-empty) amount of >> whitespace by non-empty whitespace, or can you also insert or delete >> whitespace between contiguous strings: >> - do "foobar" and "foo bar" match? >> - do "foo bar" and "foobar" match? > > The former. Or use `split string', like in > `org-export-resolve-fuzzy-link'. I'd gladly do this, but to use the `org-element-map' function it seem that I need a parse tree. How can I get it? Or is it possible to use directly `org-element-map' on a buffer? Thanks, 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) iQEcBAEBCgAGBQJUs6wZAAoJEAQNCjtO0uXH97oH/RLVVta0a31hMuSDVD7HDDfU LVZ/lM9q+aoUeRSfOfOVo4NC1KOgEiJg1uQudxO07Cw2HDj940yAM516UC3w5QHq QoRLMgKDss+daQslo2PlECgWAU4abAUYcbsAxTd7+oPQQJ8NLfTeS8mX/knmnd/Z RfkqOfQ+Lu+05aTMhb3andHrmLtXmO0pCmdQw1fQgkGPpYcoKGQTeR0eRWxijBV2 MBMgEHe7szt1Rjn8akd0Yo91haYGHhbBWclrk1y7pgQfWyVXJZmJRz9KnbA8JZWo EMt6O/AqJNDQaUQY6EtmmQnZafR+k9pIagdvoFgQlUEpu4Quo6HX4c4qD17HfEw= =QAP4 -----END PGP SIGNATURE----- --=-=-=--