From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Problem with sectioning function for LaTeX export Date: Tue, 27 Apr 2010 17:44:07 +0200 Message-ID: <674C0E7F-4F3D-40A8-A2A5-BFBA28F27C68@gmail.com> References: Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6nx1-0001HR-83 for emacs-orgmode@gnu.org; Tue, 27 Apr 2010 12:47:59 -0400 Received: from [140.186.70.92] (port=47719 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6nwz-0001Gi-Lu for emacs-orgmode@gnu.org; Tue, 27 Apr 2010 12:47:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6nww-0004xY-ON for emacs-orgmode@gnu.org; Tue, 27 Apr 2010 12:47:57 -0400 Received: from ey-out-1920.google.com ([74.125.78.144]:25492) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6nww-0004xT-Jv for emacs-orgmode@gnu.org; Tue, 27 Apr 2010 12:47:54 -0400 Received: by ey-out-1920.google.com with SMTP id 13so321448eye.34 for ; Tue, 27 Apr 2010 09:47:52 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastian Hofer Cc: emacs-orgmode@gnu.org On Apr 18, 2010, at 12:05 PM, Sebastian Hofer wrote: > Hi all, > I'm trying to write my own sectioning function for latex export of > my CV. What it does is to read out some property of the given > headline and pass it to a latex command: > > (defun my-org-cv-sectioning (lvl heading) > (let ((year) > (formatlist) > (cleanheading (substring-no-properties heading 1))) > (with-current-buffer (org-find-base-buffer-visiting "cv.org") > (let ((headingpoint (find-custom-id cleanheading))) > (if headingpoint > (progn > (goto-char headingpoint) > (setq year (org-entry-get nil "YEAR")))))) > (setq formatlist (nth (- 1 lvl) my-org-cv-sectioning-list)) > (list cleanheading > (format (car formatlist) (if year year "") cleanheading) > (format (car (cdr formatlist)) (if year year "") > cleanheading)))) > > The function find-custom-id returns the point of the heading, my-org- > cv-sectioning list contains the customized latex commands. As you > may see, I'm an elisp newbie, so excuse the coding style, or even > better, make suggestions for improvements! There might be a much > nicer way to read out the wanted properties (also cf. point 2 > below), so if you have any suggestions on that, I would be glad to > hear them! > > Anyway, there are currently two problems: > > - The function reads out the properties correctly, but the export > command throws an error. So I guess I'm not getting the format of > the output right, but I can't really make sense of the description > in the org-export-latex-classes docstring. Currently the function is > returning something like this: ("Heading" ("\section[year]{Heading}" > "\section*[year]{Heading}")). Isn't this what it's supposed to look > like? The error message is the following: I think it must be ("Heading" "\section[year]{%s}" "\section*[year]{%s}") Note the %s for the heading, and also it i just one flat list of 3 items. And yes, this is not too well documented. > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > format(nil "Heading" "") > org-export-latex-subcontent() > org-export-latex-sub() > org-export-latex-global((()))) > org-export-as-latex(nil nil nil "*Org LaTeX Export*") > org-export-as-latex-to-buffer(nil) > call-interactively(org-export-as-latex-to-buffer) > org-export(nil) > call-interactively(org-export nil nil) > > - As you can see I am using org-find-base-buffer-visiting find the > buffer of the org file, but of course its argument can't stay > hardcoded like this. I could also use the org mapping function, but > still I would need filename. Can someone give me a hint how to solve > this in a nice way? Use (org-find-base-buffer-visiting org-current-export-file) HTH - Carsten