From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: doc patch: move footnote in external links Date: Wed, 14 Jan 2015 14:19:31 +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> <87egqzehgl.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]:60721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBNrJ-0002fL-Ui for emacs-orgmode@gnu.org; Wed, 14 Jan 2015 08:19:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBNrE-0004B4-WB for emacs-orgmode@gnu.org; Wed, 14 Jan 2015 08:19:41 -0500 Received: from mx1.polytechnique.org ([129.104.30.34]:52115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBNrE-0004Ax-NE for emacs-orgmode@gnu.org; Wed, 14 Jan 2015 08:19:36 -0500 Received: from charm-ecran.irisa.fr (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 9C0D81408EFA4 for ; Wed, 14 Jan 2015 14:19:34 +0100 (CET) In-Reply-To: <87egqzehgl.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Mon, 12 Jan 2015 23:56:26 +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; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2015-01-12 23:56, Nicolas Goaziou writes: > Alan Schmitt writes: > >> Should we assume the cookie is at the end of the headline or not? > > The cookie can be anywhere within the headline text. > >> 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? > > You don't need to use `org-element-map'[fn:1]. However, you cannot just u= se > `re-search-forward' either. You probably need to map over entries (e.g., > with `org-map-entries'), apply some filter to current headline, and > compare it with link's path. This is slower than the current > implementation. > > Another option would be to ignore only contents of statistics cookies, > not the whole cookie. This way we still can turn path into a proper > regexp. Would the following work as a regexp builder that allows arbitrary space and cookies between each word (making sure there is at least one)? #+begin_src emacs-lisp (defun org-heading-regexp-build (s) (let* ((sp (reverse (org-split-string s))) (wspace "[ \t]") (wspaceopt (concat wspace "*")) (cookie (concat "\\(?:" wspaceopt "\\(?:\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]\\)" wspaceopt "\\)")) (sep (concat "\\(?:" wspace "+\\|" cookie "+\\)")) res) (dolist (w sp) (setq res (concat w sep res))) (concat sep res))) #+end_src This of course needs to be extended with the other headline features (todo keyword, tags, =E2=80=A6), this is just to know if I'm on the right t= rack. 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) iQEcBAEBCgAGBQJUtmznAAoJEAQNCjtO0uXH/McIAKnxTn6J+pZ2+5QthvUgNP70 QzSe9xlYAyBOk4AQIiT5qdCULh4uH0djxstvHMu3Mg5JfWad99Ub9WXNmHxKbYmC fUPxemb1w1qtNTjE63HbNGcSOB+siKkSFinAecZESjbnLr+fjbqLsktyhBV4Hu4F cUjB+vxaGIsZcN1iH0JR/6LcSEYbevOA4auuk4o0KSUhvjHUmBkN68dsUbOb8++Y 69XTj6QT+ZVJaf84rdtOs8eYUp1BfMJTFJqVaPYnYYwTAIMWcnNsev+k0ZDI0K1N EzdFLG35r/fryRf9W5kclAx3P0nWeaHED2nSjIgQd6xflJdfU3bvC2PThlpTRYE= =N3gO -----END PGP SIGNATURE----- --=-=-=--