From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id xlnrBgAjq171ZwAA0tVLHw (envelope-from ) for ; Thu, 30 Apr 2020 19:12:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id WB6/KQkjq16nAQAAbx9fmQ (envelope-from ) for ; Thu, 30 Apr 2020 19:12:09 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 23A90941FE4 for ; Thu, 30 Apr 2020 19:12:06 +0000 (UTC) Received: from localhost ([::1]:56542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEbN-0007QM-G0 for larch@yhetil.org; Thu, 30 Apr 2020 15:12:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEUj-0003MT-Ib for emacs-orgmode@gnu.org; Thu, 30 Apr 2020 15:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUETn-0004p7-9T for emacs-orgmode@gnu.org; Thu, 30 Apr 2020 15:05:13 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:40870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUETm-0004oa-SZ for emacs-orgmode@gnu.org; Thu, 30 Apr 2020 15:04:14 -0400 Received: by mail-wr1-x432.google.com with SMTP id e16so3300873wra.7 for ; Thu, 30 Apr 2020 12:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=Gx39e8M63cn6TdhhPl+46oNvjFVXUGLDx7QVTIS1Xq0=; b=pBJYjv01fYZ5IYo9v44riEkPJH85wOj3mk5pGiYfdyOb5hHyVJe4+2DD/eOAZQs3Nr cvMy63lkwDsiPTW+UXX1IcI+Xz05uIh3YuX8bgZlps+Y3PoWowjoMR7tWsY0gCpIyLAm UYU5wKZvAHDn9zQ6QsbnQD4f6Fq/Q2pNNiWbU1FsVSnRWsT3yav/oILhEw8laTaO7R6l xdz3mc+QcpxZCILaU3OTs5XhudOAwiQlN0USsrknLiG16LIeZUq6NaT6hNpbASybawtk 7GitcsfLWNu5uHqpq8dgGSdJkNQ94pkeD+6h+zPT5lznyJEGgs750Km7v6FYYZmIKDEW /IqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=Gx39e8M63cn6TdhhPl+46oNvjFVXUGLDx7QVTIS1Xq0=; b=qHN6m9mlE+imFJqj/oYRuyBvjFnQuAX5zdCenR7yuMLStk8IEUWEcjMmz2/f0EMqUT rx3jr8Cf0yoF6q00WzLGmRFr4JzU/hIk/XUI+2kF8I6nDD16n7qKHArMkfW3UTlYr3ZZ o4tFD1q2oLTGwGMjLMIWG5Egs0UZuoqqzQL4zdPiNhwrAMoFpgSdwy4hLAmyW9LfxGWB 20qu7hEKI0VdUZEUlFGY47vo4N4YL/ES+fWTFhZpwOLYetd/RNSE8ek2ZDneZGh6DAAA IkfosuRI3YW0kSw4Vs/oJBHpjjlgbfg3O31LwHiC6O71cQUOTVS8JB5UvLFY773Ub7uz mFeg== X-Gm-Message-State: AGi0PuZE8octUPYqKh6pqdPCtMHxT96lmbpoovRK+twSLZLAZRsyB8Cx K1ACXEaxKNqqSCwpjSMg9k4f90wPPcw= X-Google-Smtp-Source: APiQypLHRPoUPYA4+r7q+igMEzdX4Vxjs9PRmdvoZpFgueethApI0nmkgsVZ2bwnZbGkZVmybGBSdw== X-Received: by 2002:a5d:4ccb:: with SMTP id c11mr27898wrt.122.1588273451778; Thu, 30 Apr 2020 12:04:11 -0700 (PDT) Received: from localhost ([185.220.101.138]) by smtp.googlemail.com with ESMTPSA id h17sm745335wmm.6.2020.04.30.12.04.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:04:11 -0700 (PDT) From: akater To: emacs-orgmode@gnu.org Subject: Self-sufficient Org file with customised export? :eval-when? Date: Thu, 30 Apr 2020 18:55:17 +0000 Message-ID: <87imhgyfai.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=nuclearspace@gmail.com; helo=mail-wr1-x432.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::432 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: 3.29 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=pBJYjv01; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [3.29 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.49437319934214]; DWL_DNSWL_BLOCKED(0.00)[gmail.com:dkim,2001:470:142::17:from]; R_SPF_ALLOW(0.00)[+ip6:2001:470:142::/48:c]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.17), country: US(-0.00), ip: 2001:470:142::17(-0.49)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(0.00)[gmail.com,none]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[185.220.101.138:received]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[nuclearspace@gmail.com,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(0.00)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_XBL(3.00)[185.220.101.138:received]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; BAD_REP_POLICIES(0.10)[]; DNSWL_BLOCKED(0.00)[2001:470:142::17:from]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_COUNT_SEVEN(0.00)[7]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: 4vK/yQg9Cvsj I'd like to write an Org file that would export to a html with fairly significant tweaks along the way. The rough idea is, users should be able to run reasonaly recent vanilla emacs, (require 'ox), (org-html-export-to-html) and get a fine-tuned html. I also would like to move relevant Elisp to the end of the Org file because the text is going to be read by humans, and people with(out) certain background apparently faint too often when they see Lisp on top of a text written in markup. I put an emacs-lisp src block under the last unexported section, with header arguments :exports none :results none, but it does not seem to be evaluated on export. I couldn't find anything relevant in Info directory. I know that with vanilla emacs one needs to explicitly allow evaluation of blocks but that can be considred an acceptable preamble. It would also be great if exporting such a file would not alter the state of Emacs session too much (wouldn't pollute hooks or add advices, for example) but that's low priority. For now, I just want a self-contained customisation with minimal hassle for users to get the export result that was intended. What are my options? ----- If I may prematurely offer my vision: Common Lisp has special operator eval-when which specifies when the enclosed code is to be evaluated (or compiled). Example: (eval-when (:compile-toplevel) (defun f () ..)) specifies that function f should be defined during compilation only. I believe it would be neat if Org-mode widely supported :eval-when header argument inspired by Common Lisp's eval-when. Usage examples would be: #+begin_src emacs-lisp :eval-when compile load .. #+end_src #+begin_src emacs-lisp :eval-when tangle .. #+end_src #+begin_src emacs-lisp :eval-when export .. #+end_src #+begin_src emacs-lisp :eval-when () .. #+end_src where the last setting would be equivalent to the (now-supported) :eval never. In my case, I'd write a block with header arguments :eval-when export :results none if this feature was supported. I'm currently working on a Common Lisp-specific feature that will introduce :eval-when (it will be offered to a Common Lisp library literate-lisp) so I'm interested in opinions on this as well.