From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: [PATCH] ox-extra.el: Fix filtering of latex header blocks Date: Mon, 09 Nov 2015 01:30:23 -0500 Message-ID: <87oaf3it1c.fsf@kyleam.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvfyI-0006Xg-SN for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 01:30:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvfyH-0001Hw-Rn for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 01:30:30 -0500 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:36032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvfyH-0001Hs-MY for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 01:30:29 -0500 Received: by qgad10 with SMTP id d10so136086295qga.3 for ; Sun, 08 Nov 2015 22:30:29 -0800 (PST) In-Reply-To: (Sebastian Christ's message of "Fri, 09 Oct 2015 18:13:42 +0200") 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 Cc: emacs-orgmode@gnu.org Hello, Sebastian Christ writes: > Hi group, > > 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. Thanks for the patch. Sorry for the delayed response. > * ox-extra.el (org-latex-header-blocks-filter): Use `org-element' API to > find begin and end of latex header blocks. s|ox-extra.el|contrib/lisp/ox-extra.el| s/begin/beginning/ [...] > (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)) Nitpick: nth is more commonly used in the Org code base. Hmm, the pos items are constructed as (list (org-element-property :begin block) (org-element-property :end block) (org-element-property :post-affiliated block))))))) so shouldn't beg be the first element and post-affiliated the third? Hopefully Aaron will get a chance to have a look. -- Kyle