emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Subtree export problems


From: Thomas S . Dye
Subject: Re: [O] Subtree export problems
Date: Sat, 06 Feb 2016 13:03:09 -1000
User-agent: mu4e 0.9.16-1c0bfe8; emacs 24.5.1

Aloha Rasmus,

Thanks for your help.

Rasmus <address@hidden> writes:

>> 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.

Interesting, thanks, that makes sense.  So, IIUC narrowing puts the
"keywords" at the top of the buffer out of scope.  I fiddled around a
bit and came up with this, which seems to work:

,-----------------------------------------
| ** Second Level Headline                
| :PROPERTIES:                            
| :MARGIN-NOTE-FONT: \itshape\footnotesize
| :END:                                   
`-----------------------------------------

> 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.

Am I right that what John Kitchin's code (jk-org-kwd) refers to as
"keyword" should be called "property" instead?  This makes more sense to
me in light of the above.

Also, I don't understand what you mean by "hack".  Should I be wary of
using John's functions?  I find them handy to mark bits of information
that the user (usually me) might want to change.  They save the need to
rummage around a long document to find where the information is actually
used.  Should I use other functions instead?

> 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))) "")) 

This didn't work for me.  Subtree export of this one still fails:

,---------------------------------------------------------------
| ** 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                                                     
`---------------------------------------------------------------

But subtree export of this one succeeds, albeit with an empty argument
to \setmarginnotefont{} because the MARGIN-NOTE-FONT property wasn't in
the scope of the subtree:

,---------------------------------------------------------------
| ** 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 couldn't make sense of the backtrace triggered by
toggle-debug-on-quit, except to note that it reports org-babel
functions.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]