From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Christ Subject: Re: [PATCH] ox-extra.el: Fix filtering of latex header blocks Date: Tue, 10 Nov 2015 10:54:59 +0100 Message-ID: References: <87oaf3it1c.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw5e4-0002Ym-9I for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 04:55:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zw5e1-0004uY-Im for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 04:55:20 -0500 Received: from plane.gmane.org ([80.91.229.3]:49452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zw5e1-0004uU-BQ for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 04:55:17 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zw5dv-0003Sb-Mq for emacs-orgmode@gnu.org; Tue, 10 Nov 2015 10:55:11 +0100 Received: from ip5f591fba.dynamic.kabel-deutschland.de ([95.89.31.186]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Nov 2015 10:55:11 +0100 Received: from rudolfo.christ by ip5f591fba.dynamic.kabel-deutschland.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Nov 2015 10:55:11 +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@gnu.org >>>>> On Mon, 09 Nov 2015 01:30:23 -0500, Kyle Meyer said: >> * ox-extra.el (org-latex-header-blocks-filter): Use `org-element' API to >> find begin and end of latex header blocks. Kyle> Kyle> s|ox-extra.el|contrib/lisp/ox-extra.el| Kyle> s/begin/beginning/ Kyle> Thanks. I'll change that. >> (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)) Kyle> Kyle> Hmm, the pos items are constructed as Kyle> Kyle> (list (org-element-property :begin block) Kyle> (org-element-property :end block) Kyle> (org-element-property :post-affiliated block))))))) Kyle> Kyle> so shouldn't beg be the first element and post-affiliated the third? I thought it would be better to change as little as possible. Rearranging the list is obviously the cleaner solution. I'll change that. Thanks for the review. -Sebastian