From e0c77f60d81f5444e158036a72e4c74f139efee3 Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Thu, 12 May 2016 11:06:38 -0500 Subject: [PATCH 1/2] Support Emacs Org Mode based diffs We load ~/.emacs as --batch implies -q but some customization might be expected. For the same reason something like --tmpdirprefix . is necessary for .dir-locals.el to work. Finally, if on Windows and using Chocolatey, real emacs and not shim is neccesary as shim doesn't wait for process completion. path %ChocolateyInstall%\lib\emacs64\tools\emacs\bin;%PATH% --- git-latexdiff | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git-latexdiff b/git-latexdiff index f9cffff..dac37e0 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -431,6 +431,13 @@ check_knitr () { main="${main%\.*}.tex" } +check_org () { + if test -z "$prepare_cmd"; then + prepare_cmd="emacs --batch --eval \"(load \\\"~/.emacs\\\")\" \"$main\" -f org-latex-export-to-latex --kill" + fi + main="${main%\.*}.tex" +} + log_cmd () { log=$1 shift @@ -463,6 +470,7 @@ ext=${main##*\.} case "$ext" in Rnw) check_knitr ;; Rtex) check_knitr ;; + org) check_org ;; *) ;; esac From 028515df0efad4ea0c692bf5d8cceba123c81b79 Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Thu, 12 May 2016 11:06:38 -0500 Subject: [PATCH 2/2] Check presence of original file, not tranformed before it happened --- git-latexdiff | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index dac37e0..e1e6d1a 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -466,6 +466,10 @@ if test -z "$main" ; then fi fi +if test ! -r "$main" ; then + die "Cannot read $main." +fi + ext=${main##*\.} case "$ext" in Rnw) check_knitr ;; @@ -474,10 +478,6 @@ case "$ext" in *) ;; esac -if test ! -r "$main" ; then - die "Cannot read $main." -fi - verbose "Creating temporary directories" git_prefix=$(git rev-parse --show-prefix)