From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: emacs build command for org-files Date: Sun, 26 Jan 2020 15:05:58 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009b917a059d108569" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:38982) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivoAf-0001EU-Ue for emacs-orgmode@gnu.org; Sun, 26 Jan 2020 15:06:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivoAd-0001yB-PU for emacs-orgmode@gnu.org; Sun, 26 Jan 2020 15:06:13 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:33681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ivoAd-0001wZ-AP for emacs-orgmode@gnu.org; Sun, 26 Jan 2020 15:06:11 -0500 Received: by mail-wm1-x334.google.com with SMTP id m10so7212451wmc.0 for ; Sun, 26 Jan 2020 12:06:11 -0800 (PST) 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: "briangpowell ." Cc: org-mode-email --0000000000009b917a059d108569 Content-Type: text/plain; charset="UTF-8" On Sun, Jan 26, 2020 at 2:39 PM briangpowell . wrote: > "don't want it to necessarily use Makefiles" > > Why the hey not Dr. Kitchin!? > 1. I like all the build code in one file that also contains the document I am building. I know I could put a makefile in a src block and tangle it before running it, but make is not meeting my needs for this. 2. all the build code is mostly written in elisp 3. my emacs startup is slow and I don't use emacsclient so sequential build commands that launch emacs with shell arguments are too slow compared to the build sequences in src blocks. > > Make is an extremely powerful language > It is not as easy or readable for me to use as elisp, and probably not as powerful. I don't like powerful programming in shell (or make) languages, I prefer to do that in something like elisp or python where I my skills are more developed and I have better tools for debugging. > > Problem is people make makefiles that are often hard for others to > read--suggest you try hard to keep it simple & avoid the fancy ways of > doing things > Sometimes you have fancy needs that require fancy ways of doing things. > > Make has flow control & is a very rich language > I don't really need flow control for this need. > I use makefiles for every project Then Ccc to compile and/or run > everything--in Emacs--can't get easier and faster than that--as long as you > make the makefiles so easy that anyone can read & understand exactly what > it does > When they are this easy, it is nearly equivalent to simply publishing the org file to the target, so I am C-c C-e lo away from what I want. > > This is my default, which I may edit on-the-fly and just put in another > project name: > > make --ignore-errors --jobs=555 -w --keep-going --warn-undefined-variables > --environment-overrides -f ~/n/n/etc/1cv2tex2doc-project_mak.makefile > 1cv2tex2doc-project-exe > This is exactly the kind of command I might put in a build source block. I suppose you might save that as a file local variable so you can just M-x compile away though. > > All slightly interesting ways to improve make have failed slightly, in one > way or another--they catch on for a few years until they're mostly > abandoned--for very good reasons > > Look at it this way: Is there anything wrong with make? Where does it > fail? > Make is perfectly fine for sequences of shell commands that operate on files. With straight latex projects, make would be my goto. With my org files though, it is not a straight export to latex and carry on approach I use. So, I am looking for something that is more aligned with sequences of elisp commands on a buffer, and not in an asynchronous way. These command sequences are usually customized on a per document basis, otherwise I would already have wrapped them up into general export commands. > > Everyone should learn & use make > I know how to use make, and I don't like it for this purpose. The src blocks serve my needs just fine, I am just looking for an easier way to call them in large documents. > > --Brian G. Powell, M.S.--that guy that still loves Makefiles and still > loves using asterisks ("***") as bullets in OrgMode > > On Sun, Jan 26, 2020 at 1:11 PM John Kitchin > wrote: > >> 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 >> >> --0000000000009b917a059d108569 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sun, Jan 26, 2020 at 2:39 PM brian= gpowell . <briangpowellms@gm= ail.com> wrote:
"don't want it to necessarily use Makefile= s"

Why the hey not Dr. Kitchin!?

1. I like all the build code in one file that= also contains the document I am building. I know I could put a makefile in= a src block and tangle it before running it, but make is not meeting my ne= eds for this.
2. all the build code is mostly written in elisp
3. my emacs startup is slow and I don't use emacsclient so sequ= ential build commands that launch emacs with shell arguments are too slow c= ompared to the build sequences in src blocks.
=C2=A0

=
Make is an extremely powerful language
It is not as easy or readable for me to use as elisp, and prob= ably not as powerful. I don't like powerful programming in shell (or ma= ke) languages, I prefer to do that in something like elisp or python where = I my skills are more developed and I have better tools for debugging.=C2=A0=
=C2=A0

Problem is people make makefiles that ar= e often hard for others to read--suggest you try hard to keep it simple &am= p; avoid the fancy ways of doing things=C2=A0
=
Sometimes you have fancy needs that require fancy ways of do= ing things.
=C2=A0

Make has flow control &= is a very rich language

I don&= #39;t really need flow control for this need.=C2=A0


I use makefiles for every project Then Ccc to compile and/or run e= verything--in Emacs--can't get easier and faster than that--as long as = you make the makefiles so easy that anyone can read & understand exactl= y what it does

When they are th= is easy, it is nearly equivalent to simply publishing the org file to the t= arget, so I am C-c C-e lo away from what I want.=C2=A0
=C2=A0
<= br>
This is my default, which I may edit on-the-fly and just put = in another project name:

make --ignore-errors --jo= bs=3D555 -w --keep-going --warn-undefined-variables --environment-overrides= -f ~/n/n/etc/1cv2tex2doc-project_mak.makefile 1cv2tex2doc-project-exe
<= /div>

This is exactly the kind of com= mand I might put in a build source block. I suppose you might save that as = a file local variable so you can just M-x compile away though.
= =C2=A0

All slightly interesting ways to improve= make have failed slightly, in one way or another--they catch on for a few = years until they're mostly abandoned--for very good reasons
<= br>
Look at it this way: Is there anything wrong with make?=C2=A0= Where does it fail?

Make is pe= rfectly fine for sequences of shell commands that operate on files. With st= raight latex projects, make would be my goto.=C2=A0 With my org files thoug= h, it is not a straight export to latex and carry on approach I use. So, I = am looking for something that is more aligned with sequences of elisp comma= nds on a buffer, and not in an asynchronous way. These command sequences ar= e usually customized on a per document basis, otherwise I would already hav= e wrapped them up into general export commands.
=C2=A0

Everyone should learn & use make
I know how to use make, and I don't like it for this purpo= se. The src blocks serve my needs just fine, I am just looking for an easie= r way to call them in large documents.=C2=A0
=C2=A0

<= div>--Brian G. Powell, M.S.--that guy that still loves Makefiles and still = loves using asterisks ("***") as bullets in OrgMode
On Sun, = Jan 26, 2020 at 1:11 PM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
=
Hi every= one,

This is only semi-on-topic. I am looking for someth= ing like M-x compile for my org-files, but I don't want it to necessari= ly use Makefiles. I am looking for suggestions of existing solutions to thi= s, 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 comman= ds.

For most of my files, simple exporting is tota= lly adequate. But, some files are more complicated, and what I usually do i= n these cases is write an elisp code block in a section that is tagged :noe= xport: 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 refere= nces.

I have separate elisp functions that generat= e these, and then I added some custom cleanup code in the block to delete s= ome intermediate directories. I don't want to put these in a makefile b= ecause they are specific to this document. While this works, in a large doc= ument 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 chang= ed. 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 bl= ock. I could even imagine that there is a makefile block that is tangled be= fore running a shell block that runs a make command.

What I do in a function now is something like this in a save-excursion:<= /div>

(when (not (stringp (org-babel-goto-named-src-bloc= k "build")))
=C2=A0 =C2=A0 =C2=A0 (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.co= m/jkitchin/pycse/blob/master/pycse.org#L15096), I have multiple output = targets that I would run.



--0000000000009b917a059d108569--