[m-users.] GitHub release: mercury-rinse-repeat. A simplistic file watcher -- action runner

Sean Charles (emacstheviking) objitsu at gmail.com
Mon Aug 15 20:34:13 AEST 2022


Yes. Mostly I wrote this as a learning example. You suggested I write more examples and that was the result, it will end up in the FFI section soon.

I have used inotify, watchman, some awful 'grunt' solution et al. from years ago, but all of them just seemed overkill and had issues one way or another and I thought that just writing something that was minimal viable product, with Mercury as more education, would be fun. Plus this works on any platform I care to run Mercury on and forms a part of my custom toolkit I use.

 * rr - the file watcher dostuff thing
 * mlpt - my literate programming tool
 * pberr - put back errors (but a nod to Paul Bone too) as I found it it had been done decades ago! LOLZ etc

When coding in mercury now I use nano, with my 'pberr' that includes the .err file into the source file, I have a custom nano mode for Mercury, based on the Prolog one, it's not ideal but it works pretty good. All in all I am a happy bunny with Mercury these days. So glad I stuck with it and I have barely scratched the surface with it.

I don't know if this screenshot will make it through the plumbing but it's a screen shot of a Mercury literate programming session from yesterday. I used it for a few hours yesterday and it works for me just fine running code rendering and pandoc->pdf->xpdf in another window. Emacs in the right pane has auto-revert on so it refreshes when the code is re-rendered so I can see what's coming out.

Just lately mercury makes me feel like I am 12 years old again, learning BASIC in school; the frontiers are open, everything and anything is possible!





> On 15 Aug 2022, at 11:25, Richard O'Keefe <raoknz at gmail.com> wrote:
> 
> I liked the idea so much that I wrote my own 'rr'
> in another language.  There are problems, which I
> noticed in my own program first.  One I don't see
> a way around is the distinction between 'this
> file has changed in some way' and 'the series of
> changes to this file has now reached a new stable
> state where it is safe to look at.'
> 
> Of course the inotifywait(1) command, which relies
> on the Linux inotify(7) interface, has precisely
> the same issue.  It can tell when a file that was
> opened for writing has just been closed, so is
> presumably in a stable state, but it can't tell
> whether a file is in a stable state if it HASN'T
> been closed, and just because file X is now ready
> to look at doesn't mean that a connected series
> of updates to X Y and Z have now reached a stable
> point.
> 
> make(1) leaves the problem in the user's hands.
> 
> What we really need is a notion of "transaction"
> built into the file system.  (Oh, and a 50 cent
> supercomputer would be nice too. (:-))
> 
> On Mon, 15 Aug 2022 at 18:21, Volker Wysk <post at volker-wysk.de <mailto:post at volker-wysk.de>> wrote:
> Thanks for sharing!
> 
> Volker
> 
> Am Sonntag, dem 14.08.2022 um 20:05 +0100 schrieb Sean Charles
> (emacstheviking):
> > Hi,
> > 
> > In case anybody might be looking for some simple code that shows how
> > to call "C" code and also have a utility that watches files for their
> > modification timestamp(s) to change, then run a command and rinse-
> > repeat forever.
> > 
> > It builds on a sample program I released last week, if you find it
> > useful my name was Sean, if not, my name was Donald.
> > 
> > https://github.com/emacstheviking/mercury-rinse-repeat <https://github.com/emacstheviking/mercury-rinse-repeat>
> > 
> > I wrote it to drive my Literate Programming tangle/weave tool which I
> > am almost ready to publish as well, it just needs some very minor
> > tweaks before it passes muster. It's fashioned after `noweb`, in fact
> > the syntax for blocks is the same, I took inspiration from it as I
> > have used it in the past to produce working sellable Drupal modules
> > back in the bad old days.
> > 
> > The program is VERY simple and VERY naive but that's all I needed and
> > it works for me.
> > 
> > Thanks for all the comments along the way,
> > 
> > Sean.
> > 
> > _______________________________________________
> > users mailing list
> > users at lists.mercurylang.org <mailto:users at lists.mercurylang.org>
> > https://lists.mercurylang.org/listinfo/users <https://lists.mercurylang.org/listinfo/users>
> 
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org <mailto:users at lists.mercurylang.org>
> https://lists.mercurylang.org/listinfo/users <https://lists.mercurylang.org/listinfo/users>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20220815/b3079d25/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2022-08-14 at 19.56.23.png
Type: image/png
Size: 361731 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20220815/b3079d25/attachment-0001.png>


More information about the users mailing list