From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [PATCH] ox-extra.el: Fix filtering of latex header blocks Date: Tue, 10 Nov 2015 16:57:57 +0000 Message-ID: <8737wdssfe.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwCF9-0007ho-Pk for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 11:58:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwCF6-0004At-E2 for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 11:58:03 -0500 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:37712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwCF6-0004Ai-8f for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 11:58:00 -0500 Received: by wmww144 with SMTP id w144so9190938wmw.0 for ; Tue, 10 Nov 2015 08:57:59 -0800 (PST) In-Reply-To: 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: Sebastian Christ , emacs-orgmode@gnu.org Hi Sebastian, Thanks for the patch. In addition to Kyle=E2=80=99s comments: 2015ko urriak 9an, Sebastian Christ-ek idatzi zuen: >=20 > Hi group, >=20 > I'd like to provide a patch to > ox-extra.el. `org-latex-header-blocks-filter' still calls > `org-edit-src-find-region-and-lang' and raises therefore an undefined > function error. >=20 > Best wishes, > Sebastian >=20 > From 34b76e06bda5739e433c95b451915c8b804a1733 Mon Sep 17 00:00:00 2001 > From: Sebastian Christ > Date: Fri, 9 Oct 2015 17:37:39 +0200 > Subject: [PATCH] ox-extra.el: Fix filtering of latex header blocks >=20 > * ox-extra.el (org-latex-header-blocks-filter): Use `org-element' API to > find begin and end of latex header blocks. >=20 > `org-latex-header-blocks-filter' still called > `org-edit-src-find-region-and-lang' and raised an undefined function > error because the funtion was removed from org-mode. This is fixed by det= ermining the > begin and end of the latex block via `org-element'. > --- > contrib/lisp/ox-extra.el | 28 ++++++++++++++++------------ > 1 file changed, 16 insertions(+), 12 deletions(-) >=20 > diff --git a/contrib/lisp/ox-extra.el b/contrib/lisp/ox-extra.el > index e6d45cc..bb838fc 100644 > --- a/contrib/lisp/ox-extra.el > +++ b/contrib/lisp/ox-extra.el > @@ -71,18 +71,22 @@ > (org-element-property :end block) > (org-element-property :post-affiliated block))))))) > (mapc (lambda (pos) > - (goto-char (nth 2 pos)) > - (destructuring-bind > - (beg end &rest ignore) > - (org-edit-src-find-region-and-lang) > - (let ((contents-lines (split-string > - (buffer-substring-no-properties beg end) > - "\n"))) > - (delete-region (nth 0 pos) (nth 1 pos)) > - (dolist (line contents-lines) > - (insert (concat "#+latex_header: " > - (replace-regexp-in-string "\\` *" "" line) > - "\n")))))) > + (let* ((beg (third pos)) > + (end (second pos)) > + (post-affiliated (first pos)) > + (contents-lines > + (cdr (butlast > + (split-string > + (buffer-substring-no-properties post-affili= ated > + end) > + "\n") > + 2)))) Here I think you should use (org-element-property :value X) to get the contents-lines. This means that it should be added to the list that=E2=80= =99s constructed from :begin, :end, and :post-affiliated higher up. (And then I think :post-affiliated can be dropped from that list.) I=E2=80=99m not sure why I didn=E2=80=99t do it that way in the first place= , actually. --=20 Aaron Ecay