emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* emacs build command for org-files
@ 2020-01-26 18:10 John Kitchin
  2020-01-26 19:38 ` briangpowell .
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: John Kitchin @ 2020-01-26 18:10 UTC (permalink / raw)
  To: org-mode-email

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

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

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

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

end of thread, other threads:[~2020-01-27 19:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-26 18:10 emacs build command for org-files John Kitchin
2020-01-26 19:38 ` briangpowell .
2020-01-26 20:05   ` John Kitchin
2020-01-26 21:13   ` briangpowell .
2020-01-27 15:53     ` John Kitchin
2020-01-27 17:38       ` Jack Kamm
2020-01-27 19:13         ` John Kitchin
2020-01-27  8:16 ` Stefan Nobis
2020-01-27 13:33   ` John Kitchin
2020-01-27 12:40 ` Neil Jerram
2020-01-27 13:16   ` John Kitchin

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