emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Yagnesh Raghava Yakkala <hi@yagnesh.org>
To: emacs-orgmode@gnu.org
Subject: Re: Near real-time preview of PDF/ODT export?
Date: Mon, 25 Nov 2013 21:25:04 +0900	[thread overview]
Message-ID: <87bo184qjj.fsf@yagnesh.org> (raw)
In-Reply-To: 87wqk0o7uj.fsf@bzg.ath.cx

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

On Nov 22 2013, Bastien <bzg@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. 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: watcher.sh --]
[-- Type: text/x-sh, Size: 385 bytes --]

#!/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 #3: Makefile --]
[-- Type: application/octet-stream, Size: 712 bytes --]

EMACS=emacs
BATCH_EMACS=$(EMACS) --batch -Q -l init.el
MAINDOC	= paper
RM = rm

%.tex:
	$(BATCH_EMACS) $*.org -f org-latex-export-to-latex

%.pdf: %.tex
	if pdflatex $*.tex </dev/null; then \
		true; \
	else \
		stat=$$?; touch $*.pdf; exit $$stat; \
	fi
	bibtex $*
	while grep "Rerun to get" $*.log; do \
		if pdflatex $*.tex </dev/null; then \
			true; \
		else \
			stat=$$?; touch $*.pdf; exit $$stat; \
		fi; \
	done

all: pdf
tex: $(MAINDOC).tex
pdf: $(MAINDOC).pdf
html:
	$(BATCH_EMACS) $(MAINDOC).org -f org-html-export-as-html

clean:
	$(RM) -f *.aux *.bbl *.blg *.log

cleanall : clean
	$(RM) -f *.dvi *.cfg *.idx *.ilg *.ind *.toc *.lot *.lof *.pdf *.out
	$(RM) -rf $(MAINDOC)

.PHONY: clean cleanall

[-- Attachment #4: init.el --]
[-- Type: application/emacs-lisp, Size: 1020 bytes --]

[-- Attachment #5: Type: text/plain, Size: 116 bytes --]


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

  parent reply	other threads:[~2013-11-25 12:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 13:59 Near real-time preview of PDF/ODT export? Bastien
2013-11-22 14:30 ` Rasmus
2013-11-22 14:51   ` Suvayu Ali
2013-11-25  8:54     ` Torsten Wagner
2013-11-25 10:35       ` Alan Schmitt
2013-11-25 13:25         ` Torsten Wagner
2013-11-25 14:20           ` Alan Schmitt
2013-11-25 17:58             ` Jambunathan K
2013-11-26  8:59               ` Alan Schmitt
2013-11-25 19:24             ` Achim Gratz
2013-11-22 14:32 ` Thorsten Jolitz
2013-11-25 12:25 ` Yagnesh Raghava Yakkala [this message]
2013-11-26  4:06   ` Feng Shu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bo184qjj.fsf@yagnesh.org \
    --to=hi@yagnesh.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).