emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* What's the canonical way to pass information within an Org exporter?
@ 2018-02-06 23:35 Kaushal Modi
  2018-02-09  4:45 ` Yasushi SHOJI
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2018-02-06 23:35 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

Hello,

I believe the info plist should be used ideally, but I cannot figure out
how to tap in new information or update existing information in the `info'
channel used throughout the exporter.

Here's an example:

(1) I am saving the "description" Special Block content to a global var
org-hugo--description:

(defun org-hugo-special-block (special-block contents info)
  (let ((block-type (org-element-property :type special-block))
        (contents (org-trim contents)))
    (cond
     ((string= block-type "description")
      (setq org-hugo--description contents)
      nil)
     ;; -- snip --
     )))

(2) Then I am retrieving that saved variable inside a nested function call
in org-hugo-body-filter, where I use it as:

(or org-hugo--description
                          (org-string-nw-p (plist-get info :description)))

I know that this is very ugly, but it works.

Now I am looking for a way to optimize this bit of code.. to figure out how
to add/update :description in the `info' channel from within
org-hugo-special-block. That way I need to do just the below inside
org-hugo-body-filter:

(org-string-nw-p (plist-get info :description))


Thank you.


Full code:
https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/ox-hugo.el
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1765 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's the canonical way to pass information within an Org exporter?
  2018-02-06 23:35 What's the canonical way to pass information within an Org exporter? Kaushal Modi
@ 2018-02-09  4:45 ` Yasushi SHOJI
  2018-02-10 15:48   ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Yasushi SHOJI @ 2018-02-09  4:45 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Hi,

On Wed, Feb 7, 2018 at 8:35 AM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
> I believe the info plist should be used ideally, but I cannot figure out how
> to tap in new information or update existing information in the `info'
> channel used throughout the exporter.

Some exporter does `plist-put`.
Is that what you are looking for?
-- 
          yashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's the canonical way to pass information within an Org exporter?
  2018-02-09  4:45 ` Yasushi SHOJI
@ 2018-02-10 15:48   ` Kaushal Modi
  2018-02-12  2:24     ` Kaushal Modi
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2018-02-10 15:48 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

On Thu, Feb 8, 2018, 11:45 PM Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:

>
> Some exporter does `plist-put`.
> Is that what you are looking for?


Hello Yashi,

I have used plist-put before, but I am not sure it if it sets the plist
values by reference.  What I want is to set a plist value in one function,
and retrieve it in another.

That said, I haven't tried plist put/get across functions.. I'll try that
out.


-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 863 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What's the canonical way to pass information within an Org exporter?
  2018-02-10 15:48   ` Kaushal Modi
@ 2018-02-12  2:24     ` Kaushal Modi
  0 siblings, 0 replies; 4+ messages in thread
From: Kaushal Modi @ 2018-02-12  2:24 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

On Sat, Feb 10, 2018 at 10:48 AM Kaushal Modi <kaushal.modi@gmail.com>
wrote:

> On Thu, Feb 8, 2018, 11:45 PM Yasushi SHOJI <yasushi.shoji@gmail.com>
> wrote:
>
>>
>> Some exporter does `plist-put`.
>> Is that what you are looking for?
>
>
>  I haven't tried plist put/get across functions.. I'll try that out.


That worked! Many thanks! :)
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 976 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-12  2:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 23:35 What's the canonical way to pass information within an Org exporter? Kaushal Modi
2018-02-09  4:45 ` Yasushi SHOJI
2018-02-10 15:48   ` Kaushal Modi
2018-02-12  2:24     ` Kaushal Modi

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