From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thibault Marin Subject: Re: getting access to a self-invented option? Date: Sat, 03 Aug 2019 01:28:12 -0400 Message-ID: <875zne4y37.fsf@dell-desktop.WORKGROUP> References: Reply-To: thibault.marin@gmx.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:43286) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htmak-0006TF-Ms for emacs-orgmode@gnu.org; Sat, 03 Aug 2019 01:28:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htmai-0003Ea-OP for emacs-orgmode@gnu.org; Sat, 03 Aug 2019 01:28:30 -0400 Received: from mout.gmx.net ([212.227.15.19]:34081) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1htmag-00038G-Fv for emacs-orgmode@gnu.org; Sat, 03 Aug 2019 01:28:27 -0400 In-reply-to: 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" To: Matt Price Cc: Org Mode 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=3D 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. On 2019-08-02T12:10:18-0400, Matt Price wrote: I'm trying to streamline some veyr ad-hoc workflows I have. One thing I = do a lot during the school year is make some changes to an org source file, and then export to hugo markdown with ox-hugo, and finally commit to git (after that I have a git hook that generates the website & uploads the changed pages to the appropriate location, usually a github-pages branch= or separate repo). So I have this code: (defun mwp-hugo-export-and-release () "Make it faster and easier to put my lectures up on the website." (interactive) (let* ((modfile (org-hugo-export-wim-to-md)) (basedir (plist-get (org-export-get-environment 'hugo) ':hugo-base-dir )) (default-directory (expand-file-name basedir))) (magit-stage-file modfile) ;; (magit-status) (magit-commit-create) ) ) It works great, I'm very happy. HOWEVER: in my websites I have two kinds= of outputs: - regular pages -- these get exported to .md files and turned into html = by hugo - lecture notes -- these get exported to reveal.js HTML pages by org-re-reveal and my hugo theme treats them differently . I would really like to set a switch somewhere in the file, something lik= e: #+MWP_EXPORT_TYPE: slides And then something like let* ((modfile (if (eq :mwp-export-type "slides") (mwp-hugo-reveal-custom-export-function) (org-hugo-export-wim-to-md))) ....etc) do stuff) But I'm not sure how to get access to a totally non-standard option like the kind I just invented in that last bit of pseudo-code. Anyone have a good suggestion? Thank you as always! Matt