From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: emacs build command for org-files Date: Sun, 26 Jan 2020 13:10:22 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000028c11c059d0ee833" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52079) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivmMo-00059W-Hm for emacs-orgmode@gnu.org; Sun, 26 Jan 2020 13:10:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivmMn-0001pv-43 for emacs-orgmode@gnu.org; Sun, 26 Jan 2020 13:10:38 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ivmMm-0001me-LK for emacs-orgmode@gnu.org; Sun, 26 Jan 2020 13:10:37 -0500 Received: by mail-wr1-x42d.google.com with SMTP id q10so8167804wrm.11 for ; Sun, 26 Jan 2020 10:10:35 -0800 (PST) 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: org-mode-email --00000000000028c11c059d0ee833 Content-Type: text/plain; charset="UTF-8" Hi everyone, This is only semi-on-topic. I am looking for something like M-x compile for my org-files, but I don't want it to necessarily use Makefiles. I am looking for suggestions of existing solutions to this, or thoughts on how to implement this. Actually, if it was possible to get M-x compile to run an elisp function instead of a make file, it might be all I need, but it looks like it runs shell commands. For most of my files, simple exporting is totally adequate. But, some files are more complicated, and what I usually do in these cases is write an elisp code block in a section that is tagged :noexport: and then I run that block to build the result. A recent example was a proposal where I needed a pdf of the body, and separate pdf of the references. I have separate elisp functions that generate these, and then I added some custom cleanup code in the block to delete some intermediate directories. I don't want to put these in a makefile because they are specific to this document. While this works, in a large document I find it a little inconvenient to make a small change say at the top, and then to jump to the bottom to run the build block to see how it changed. What I would prefer is to just run a command like M-x org-compile that would know about this build block and run it. That block could of course be a shell block that runs a makefile, but it would most often be an elisp block. I could even imagine that there is a makefile block that is tangled before running a shell block that runs a make command. What I do in a function now is something like this in a save-excursion: (when (not (stringp (org-babel-goto-named-src-block "build"))) (org-babel-execute-src-block)) I don't use this in these projects, but they highlight some of the complexities I am trying to simplify. These are book like projects with special formatting needs, and multiple outputs. In this project ( https://github.com/jkitchin/pycse/blob/master/pycse.org#L15096), I have multiple output targets that I would run. In this project ( https://github.com/jkitchin/dft-book/blob/master/dft.org#build) I use some temporary filters to save the src blocks to files, and to embed them in the pdf so they can be opened. Anyway, it feels like I am reinventing something here, and that there might be some better approach already out there. Maybe some elisp equivalent of a makefile or something? Thoughts? John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu --00000000000028c11c059d0ee833 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi everyone,

This is only semi-on-topic= . I am looking for something like M-x compile for my org-files, but I don&#= 39;t want it to necessarily use Makefiles. I am looking for suggestions of = existing solutions to this, or thoughts on how to implement this.

Actually, if it was possible to get M-x compile to run an e= lisp function instead of a make file, it might be all I need, but it looks = like it runs shell commands.

For most of my files,= simple exporting is totally adequate. But, some files are more complicated= , and what I usually do in these cases is write an elisp code block in a se= ction that is tagged :noexport: and then I run that block to build the resu= lt. A recent example was a proposal where I needed a pdf of the body, and s= eparate pdf of the references.

I have separate eli= sp functions that generate these, and then I added some custom cleanup code= in the block to delete some intermediate directories. I don't want to = put these in a makefile because they are specific to this document. While t= his works, in a large document I find it a little inconvenient to make a sm= all change say at the top, and then to jump to the bottom to run the build = block to see how it changed. What I would prefer is to just run a command l= ike M-x org-compile that would know about this build block and run it. That= block could of course be a shell block that runs a makefile, but it would = most often be an elisp block. I could even imagine that there is a makefile= block that is tangled before running a shell block that runs a make comman= d.

What I do in a function now is something like t= his in a save-excursion:

(when (not (stringp (org-= babel-goto-named-src-block "build")))
=C2=A0 =C2=A0 =C2=A0 (or= g-babel-execute-src-block))

I don't use th= is in these projects, but they highlight some of the complexities I am tryi= ng to simplify. These are book like projects with special formatting needs,= and multiple outputs.

In this project (https://gi= thub.com/jkitchin/pycse/blob/master/pycse.org#L15096), I have multiple = output targets that I would run.

In this project (= = https://github.com/jkitchin/dft-book/blob/master/dft.org#build) I use s= ome temporary filters to save the src blocks to files, and to embed them in= the pdf so they can be opened.

Anyway, it feels l= ike I am reinventing something here, and that there might be some better ap= proach already out there. Maybe some elisp equivalent of a makefile or some= thing?=C2=A0

Thoughts?

John

---------------= --------------------
Professor John Kitchin=C2=A0
Doherty Hall A207F<= br>Department of Chemical Engineering
Carnegie Mellon University
Pitt= sburgh, PA 15213
412-268-7803
--00000000000028c11c059d0ee833--