emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] getting access to a self-invented option?


From: Matt Price
Subject: Re: [O] getting access to a self-invented option?
Date: Wed, 7 Aug 2019 11:30:19 -0400



On Sat, Aug 3, 2019 at 1:28 AM Thibault Marin <address@hidden> wrote:
Hi,

I am not sure where you are trying to get to the value (in the
publishing function?), but I use something like the following to handle
custom keywords:

,----
| #+MWP_EXPORT_TYPE: slides
|
| #+name: elt
| #+begin_src emacs-lisp :results silent :exports none
| (let ((tree (org-element-parse-buffer)))
|   (org-element-map
|       tree 'keyword
|     (lambda (r)
|       (let ((key (org-element-property :key r))
|             (value (org-element-property :value r)))
|         (when (string= key "MWP_EXPORT_TYPE")
|           value))) ;; Return the keyword value
|     nil t))
| #+end_src
`----

If you have access to the parsed tree or the buffer filename, you may be
able to use this or something similar (maybe wrapped in a function).

Hope it helps.


I think this is a pretty good option -- I would use this in an interactive function that is called from the org buffer, so I should be able to parse it. I keep all my lectures in a single file, and same for all my other course materials, so I guess I will have to do some testing and see how long the parse operation takes...



reply via email to

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