From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Subtree export problems Date: Sat, 06 Feb 2016 15:17:33 +0100 Message-ID: <87pow93oua.fsf@gmx.us> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS3gK-0004tV-DM for emacs-orgmode@gnu.org; Sat, 06 Feb 2016 09:17:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aS3gE-0003xj-Mw for emacs-orgmode@gnu.org; Sat, 06 Feb 2016 09:17:48 -0500 Received: from plane.gmane.org ([80.91.229.3]:35150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS3gE-0003wr-Fc for emacs-orgmode@gnu.org; Sat, 06 Feb 2016 09:17:42 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aS3gD-00037O-7M for emacs-orgmode@gnu.org; Sat, 06 Feb 2016 15:17:41 +0100 Received: from tsn109-201-154-208.dyn.nltelcom.net ([109.201.154.208]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Feb 2016 15:17:41 +0100 Received: from rasmus by tsn109-201-154-208.dyn.nltelcom.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Feb 2016 15:17:41 +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 Cc: aaronecay@gmail.com Hi Tom, Thanks for your report. Thomas S. Dye writes: > The following ECM gives me two problems. Next time it would help the reading flow if you start with the example (IMO, so if you disagree please ignore). > 1) When I export the full file, all is well, I get this > pertinent part: > > ,------------------------------------------ | \section{Top Level > Headline} | \label{sec:orgheadline2} > | \setmarginnotefont{\itshape\footnotesize} | > | \subsection{Second Level Headline} | > \label{sec:orgheadline1} | > | \setmarginnotefont{\itshape\footnotesize} > `------------------------------------------ > > However, when I attempt to export the Second Level Headline > subtree, I get this pertinent part: > > ,------------------------ | \setmarginnotefont{nil} > `------------------------ How could it do anything else? Try to narrow to the subtree and run your code (see also org-export-as and how subtree export works; it narrows). You will see that your code returns nil. You are using a hack to use something that you think looks like a Org keyword, but which is not (in particular it’s unknown to ox backends). I think you can check org-export-get-environment and org-export-define-backend to appreciate this. > 2) Subtree export doesn't work when the Second Level Headline is > followed on the next line by the #+header: line (with no empty > line or some text between them). I'm left in the *Org Export > Dispatcher*, where I can get out with C-g. Aside: I had a hard time understanding this, but I can reproduce the bug with this ** Second Level Headline #+header: :var marginnote-font=(jk-org-kwd "MARGIN-NOTE-FONT") #+header: :results raw :exports results #+begin_src emacs-lisp (format "\\setmarginnotefont{%s}" marginnote-font) #+end_src I’m pretty sure you more well-versed in debugging than me Tom, but I will include the following for other people who might follow the thread: To see what it going on here it helps to do M-x toggle-debug-on-quit and hit C-g. It will pop up a backtrace. I am honestly not sure if this if there’s a bug here. What seems to happen is that it keeps looking for a value for marginnote-font which is nil cf. above. But it could also be that your jk-org-kwd function is simply malfunctioning cf. below. Why does this not happen when you have plenty of newlines? I don’t know. Maybe Aaron will be able to tell us if it’s a bug. In any case, you can fix the second case by redefining your function to never return nil. (defun jk-org-kwd (KEYWORD) "get the value of a KEYWORD in the form of #+KEYWORD: value" (or (cdr (assoc KEYWORD (jk-org-kwds))) "")) Hope it helps even if I’m unable to give an definite answer regarding your second observation. Rasmus -- Need more coffee. . .