From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: running some elisp code when exporting a given file Date: Thu, 05 Sep 2013 09:58:15 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHUSP-0004ew-R9 for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 03:58:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHUSI-0001lQ-Ho for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 03:58:25 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:16416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHUSI-0001kO-B5 for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 03:58:18 -0400 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Hello, I would like to inline a css when exporting a file to html, but I don't know how to tell org-mode to set the variable org-html-head from within the file. Here is what I tried: I added the following block at the beginning of my file: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC emacs-lisp :exports none (set (make-local-variable 'org-html-head) (concat "\n")) #+END_SRC --8<---------------cut here---------------end--------------->8--- It does not seem to be evaluated, however. Is there a way to have arbitrary code stored in the file being exported being evaluated before an export? Thanks, Alan From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: running some elisp code when exporting a given file Date: Thu, 05 Sep 2013 11:07:09 +0100 Message-ID: <87mwnrr38y.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWTB-0008Cx-Ar for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 06:07:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHWT2-0006cC-SV for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 06:07:21 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:32812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWT2-0006c4-Lw for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 06:07:12 -0400 Received: by mail-wi0-f181.google.com with SMTP id c10so1604154wiw.8 for ; Thu, 05 Sep 2013 03:07:11 -0700 (PDT) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: emacs-orgmode Hi Alan, Alan Schmitt writes: > Is there a way to have arbitrary code stored in the file being exported > being evaluated before an export? I think you can use org-export-before-processing-hook for this. """ 12.13 Advanced configuration ============================ Hooks ----- Two hooks are run during the first steps of the export process. The first one, 'org-export-before-processing-hook' is called before expanding macros, Babel code and include keywords in the buffer. The second one, 'org-export-before-parsing-hook', as its name suggests, happens just before parsing the buffer. Their main use is for heavy duties, that is duties involving structural modifications of the document. For example, one may want to remove every headline in the buffer during export. """ Myles From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: running some elisp code when exporting a given file Date: Thu, 05 Sep 2013 12:13:05 +0200 Message-ID: <8761ufr2z2.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWYg-00019Z-DV for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 06:13:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHWYW-0000My-2f for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 06:13:02 -0400 Received: from mail-we0-x234.google.com ([2a00:1450:400c:c03::234]:54500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHWYV-0000Mm-Rg for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 06:12:51 -0400 Received: by mail-we0-f180.google.com with SMTP id u57so442418wes.25 for ; Thu, 05 Sep 2013 03:12:51 -0700 (PDT) In-Reply-To: (Alan Schmitt's message of "Thu, 05 Sep 2013 09:58:15 +0200") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: emacs-orgmode Hello, Alan Schmitt writes: > I would like to inline a css when exporting a file to html, but I don't > know how to tell org-mode to set the variable org-html-head from within > the file. > > Here is what I tried: I added the following block at the beginning of my > file: > > #+BEGIN_SRC emacs-lisp :exports none > (set (make-local-variable 'org-html-head) (concat > "\n")) > #+END_SRC > > It does not seem to be evaluated, however. > > Is there a way to have arbitrary code stored in the file being exported > being evaluated before an export? I think this has to do with ":exports none", which means that code will not be evaluated during export. You may want to try setting the attribute to some other value, and put the block in a :noexport: entry. Regards, -- Nicolas Goaziou From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: running some elisp code when exporting a given file Date: Thu, 05 Sep 2013 14:39:15 +0200 Message-ID: References: <8761ufr2z2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHYqI-0002MA-3D for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 08:39:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHYqB-0004Gx-Sj for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 08:39:22 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:53519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHYqB-0004Gs-MG for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 08:39:15 -0400 In-reply-to: <8761ufr2z2.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode n.goaziou@gmail.com writes: > Hello, > > Alan Schmitt writes: > >> I would like to inline a css when exporting a file to html, but I don't >> know how to tell org-mode to set the variable org-html-head from within >> the file. >> >> Here is what I tried: I added the following block at the beginning of my >> file: >> >> #+BEGIN_SRC emacs-lisp :exports none >> (set (make-local-variable 'org-html-head) (concat >> "\n")) >> #+END_SRC >> >> It does not seem to be evaluated, however. >> >> Is there a way to have arbitrary code stored in the file being exported >> being evaluated before an export? > > I think this has to do with ":exports none", which means that code will > not be evaluated during export. You may want to try setting the > attribute to some other value, and put the block in a :noexport: entry. Thanks a lot, this was it. Alan From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: running some elisp code when exporting a given file Date: Thu, 05 Sep 2013 14:39:00 +0200 Message-ID: References: <87mwnrr38y.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHYq4-000253-TU for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 08:39:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHYpx-0004EP-Jw for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 08:39:08 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:24962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHYpx-0004EL-Do for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 08:39:01 -0400 In-reply-to: <87mwnrr38y.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Myles English Cc: emacs-orgmode mylesenglish@gmail.com writes: > Hi Alan, > > Alan Schmitt writes: > >> Is there a way to have arbitrary code stored in the file being exported >> being evaluated before an export? > > I think you can use org-export-before-processing-hook for this. Thank you for the suggestion. My question would then be: how do I set the hook from within the file being exported? (And the answer is: apply Nicolas's suggestion, it worked.) Alan From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: running some elisp code when exporting a given file Date: Fri, 06 Sep 2013 11:41:36 -0600 Message-ID: <87eh91q23z.fsf@gmail.com> References: <8761ufr2z2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VI02o-0004BM-NF for emacs-orgmode@gnu.org; Fri, 06 Sep 2013 13:42:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VI025-0008Qn-78 for emacs-orgmode@gnu.org; Fri, 06 Sep 2013 13:42:06 -0400 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:49678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VI024-0008QX-W6 for emacs-orgmode@gnu.org; Fri, 06 Sep 2013 13:41:21 -0400 Received: by mail-pa0-f42.google.com with SMTP id lj1so3636466pab.29 for ; Fri, 06 Sep 2013 10:41:19 -0700 (PDT) In-Reply-To: (Alan Schmitt's message of "Thu, 05 Sep 2013 14:39:15 +0200") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: emacs-orgmode , Nicolas Goaziou Alan Schmitt writes: > n.goaziou@gmail.com writes: > >> Hello, >> >> Alan Schmitt writes: >> >>> I would like to inline a css when exporting a file to html, but I don't >>> know how to tell org-mode to set the variable org-html-head from within >>> the file. >>> >>> Here is what I tried: I added the following block at the beginning of my >>> file: >>> >>> #+BEGIN_SRC emacs-lisp :exports none >>> (set (make-local-variable 'org-html-head) (concat >>> "\n")) >>> #+END_SRC >>> >>> It does not seem to be evaluated, however. >>> >>> Is there a way to have arbitrary code stored in the file being exported >>> being evaluated before an export? >> >> I think this has to do with ":exports none", which means that code will >> not be evaluated during export. You may want to try setting the >> attribute to some other value, and put the block in a :noexport: entry. > > Thanks a lot, this was it. > Just for completeness, another option may be the following set of header arguments. #+begin_src emacs-lisp :exports results :results none ;; code executed for side effects #+end_src Cheers, -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D