On Nov 22 2013, Bastien <b...@gnu.org> wrote:

Hello all,

I have been using a simple bash script with a Makefile to make pdf file to be
updated with org source on each save while I am editing. It is working fine
for me. Of course its not exactly real time but fast enough feedback for me.

I am attaching my files hoping that they may be useful for others. one may
need to edit init.el and Makefile for their use case.  I run something like
this.

$ watcher.sh paper.org make

Watcher script checks every second to see if the org file is modified and runs
make command. 

#!/bin/bash

FILE="$1"
CMD="$2"
LAST=`ls -l "$FILE"`
while true; do
    sleep 1
    NEW=`ls -l "$FILE"`
    if [ "$NEW" != "$LAST" ]; then
        t="$(date +%s)"
        echo "watcher action started at "  $(date)
        "$CMD" 2>&1 | tee /tmp/wathcer.log.$$
        LAST="$NEW"
        t="$(($(date +%s)-t))"
        printf "done; %02d:%02d\n" "$((t/60%60))" "$((t%60))"
    fi
done

Attachment: Makefile
Description: Binary data

Attachment: init.el
Description: application/emacs-lisp

Thanks.,
-- 
ఎందరో మహానుభావులు అందరికి వందనములు.
YYR

Reply via email to