# HG changeset patch # User Robert McIntyre # Date 1319473757 25200 # Node ID 5370428e673ed75049ce8a7c395c8a9c4d045967 # Parent 4824087ce1f2bfc98487592a09fcec77bbe4d8b9 experimenting with a perlscript for weaving diff -r 4824087ce1f2 -r 5370428e673e auto-weave.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/auto-weave.pl Mon Oct 24 09:29:17 2011 -0700 @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +use Linux::Inotify2; +use AnyEvent; + + +my $inotify = new Linux::Inotify2 + or die "unable to create new inotify object: $!"; + + +@org_files = glob("./org/*.org"); + +$" = "\n"; +print "@org_files"; + + +foreach(@org_files){ +# add watchers +$inotify->watch ($_, IN_MODIFY, sub +{ + my $e = shift; + my $name = $e->fullname; + print "$name was modified\n" if $e->IN_MODIFY; + ` + +}); + + + + +} + + + + +# integration into AnyEvent (works with EV, Glib, Tk, POE...) +my $inotify_w = AnyEvent->io + ( + fh => $inotify->fileno, poll => 'r', cb => sub { $inotify->poll } + ); + + # manual event loop +1 while $inotify->poll; diff -r 4824087ce1f2 -r 5370428e673e old-weave.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/old-weave.sh Mon Oct 24 09:29:17 2011 -0700 @@ -0,0 +1,34 @@ +#!/bin/sh + +# assumes ./org directory with org files to publish to +# ./html + +#target=$(readlink -f $1) + +dir=`pwd` + +emacs \ +-l /home/r/config/emacs/clojure-init.el \ +-l /home/r/config/emacs/org-init.el \ +-l /home/r/config/emacs/web-color.el \ +--batch \ +--eval " +(progn +(setq org-publish-project-alist + '( + (\"project\" + :base-directory \"$dir/org\" + :base-extension \"org\" + :publishing-directory \"$dir/html\" + :recursive t + :publishing-function org-publish-org-to-html + :auto-preamble t) + )) + +(org-publish-project \"project\"))" \ +\ +2>&1 #| pcregrep 'Wrote' + + + + diff -r 4824087ce1f2 -r 5370428e673e weave.sh --- a/weave.sh Mon Oct 24 08:31:37 2011 -0700 +++ b/weave.sh Mon Oct 24 09:29:17 2011 -0700 @@ -3,34 +3,11 @@ # assumes ./org directory with org files to publish to # ./html -#target=$(readlink -f $1) +target=$(readlink -f $1) dir=`pwd` -# emacs \ -# -l /home/r/config/emacs/clojure-init.el \ -# -l /home/r/config/emacs/org-init.el \ -# -l /home/r/config/emacs/web-color.el \ -# --batch \ -# --eval " -# (progn -# (setq org-publish-project-alist -# '( -# (\"project\" -# :base-directory \"$dir/org\" -# :base-extension \"org\" -# :publishing-directory \"$dir/html\" -# :recursive t -# :publishing-function org-publish-org-to-html -# :auto-preamble t) -# )) - -# (org-publish-project \"project\"))" \ -# \ -# 2>&1 #| pcregrep 'Wrote' - - -emacsclient \ +emacsclient \ --eval " (progn (setq org-publish-project-alist @@ -44,8 +21,20 @@ :auto-preamble t) )) -(org-publish-project \"project\"))" \ +(org-publish-file \"$target\" '(\"project\" + :base-directory \"$dir/org\" + :base-extension \"org\" + :publishing-directory \"$dir/html\" + :recursive t + :publishing-function org-publish-org-to-html + :auto-preamble t) + ))" \ +\ +2>&1 #| pcregrep 'Wrote' + + +