emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas S. Dye <tsd@tsdye.com>
To: Rasmus <rasmus@gmx.us>
Cc: aaronecay@gmail.com, emacs-orgmode@gnu.org
Subject: Re: Subtree export problems
Date: Sat, 06 Feb 2016 13:03:09 -1000	[thread overview]
Message-ID: <m2zivdh26q.fsf@tsdye.com> (raw)
In-Reply-To: <87pow93oua.fsf@gmx.us>

Aloha Rasmus,

Thanks for your help.

Rasmus <rasmus@gmx.us> 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

  parent reply	other threads:[~2016-02-06 23:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-06  0:34 Subtree export problems Thomas S. Dye
2016-02-06 14:17 ` Rasmus
2016-02-06 22:08   ` Aaron Ecay
2016-02-06 22:24     ` Rasmus
2016-02-06 23:39     ` Thomas S. Dye
2016-02-06 23:03   ` Thomas S. Dye [this message]
2016-02-07  0:14     ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2zivdh26q.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).