From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Tim Haga <timhaga@ebene6.org>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] git-latexdiff: new command in contrib, to use latexdiff and Git
Date: Thu, 16 Feb 2012 09:34:48 +0100 [thread overview]
Message-ID: <vpq39abrxav.fsf@bauges.imag.fr> (raw)
In-Reply-To: <20120216003300.17228570@sirion> (Tim Haga's message of "Thu, 16 Feb 2012 00:33:00 +0100")
Tim Haga <timhaga@ebene6.org> writes:
> While testing your script on my office machine i discovered that the
> following might be a problem:
>
>> +if [ "$view" = 1 ] || [ "$view" = maybe ] && [ "$output" = "" ]; then
>> + xpdf "$pdffile"
>> +fi
>
> Xpdf is not installed on all machines (e.g. it's not installed on my
> office machine), so maybe it would be a good idea to use a environment
> variable instead?
Right. I'm squashing this into the next version to allow configuration
(environment variable or --pdf-viewer) and sensible auto-detection:
diff --git a/contrib/latex/git-latexdiff b/contrib/latex/git-latexdiff
index 13aeb9a..85aafda 100755
--- a/contrib/latex/git-latexdiff
+++ b/contrib/latex/git-latexdiff
@@ -20,6 +20,8 @@ Options:
--no-view Don't display the resulting PDF file
--view View the resulting PDF file
(default if -o is not used)
+ --pdf-viewer CMD
+ Use CMD to view the PDF file (default: \$PDFVIEWER)
--no-cleanup Don't cleanup temp dir after running
-o FILE, --output FILE
Copy resulting PDF into FILE
@@ -46,7 +48,7 @@ verbose_progress () {
verbose_done () {
if [ "$verbose" = 1 ]; then
- echo " done."
+ echo " ${1:-done}."
fi
}
@@ -75,6 +77,10 @@ while test $# -ne 0; do
"--view")
view=1
;;
+ "--pdf-viewer")
+ shift
+ PDFVIEWER="$1"
+ ;;
"--no-cleanup")
cleanup=0
;;
@@ -114,6 +120,28 @@ if [ "$old" = "" ]; then
exit 1
fi
+verbose "Auto-detecting PDF viewer"
+for command in xdg-open evince okular xpdf acroread; do
+ if [ "$PDFVIEWER" = "" ]; then
+ if command -v "$command" >/dev/null 2>&1; then
+ PDFVIEWER="$command"
+ else
+ verbose_progress
+ fi
+ fi
+done
+verbose_done "$PDFVIEWER"
+
+case "$view" in
+ maybe|1)
+ if [ "$PDFVIEWER" = "" ]; then
+ echo "warning: could not find a PDF viewer on your system."
+ echo "warning: Please set \$PDFVIEWER or use --pdf-viewer CMD."
+ PDFVIEWER=false
+ fi
+ ;;
+esac
+
if [ "$main" = "" ]; then
printf "%s" "No --main provided, trying to guess ... "
main=$(git grep -l '^[ \t]*\\documentclass')
@@ -212,7 +240,7 @@ if [ "$output" != "" ]; then
fi
if [ "$view" = 1 ] || [ "$view" = maybe ] && [ "$output" = "" ]; then
- xpdf "$pdffile"
+ "$PDFVIEWER" "$pdffile"
fi
if [ "$cleanup" = 1 ]; then
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2012-02-16 8:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 15:49 [PATCH] git-latexdiff: new command in contrib, to use latexdiff and Git Matthieu Moy
2012-02-15 23:33 ` Tim Haga
2012-02-16 8:34 ` Matthieu Moy [this message]
2012-02-16 8:39 ` [PATCH v2] " Matthieu Moy
2012-02-16 9:15 ` Jakub Narebski
2012-02-16 19:24 ` David Aguilar
2012-02-16 8:47 ` [PATCH] " Steven Michalske
2012-02-16 8:59 ` Matthieu Moy
2012-02-16 12:36 ` [PATCH v3] " Matthieu Moy
2012-02-16 13:40 ` Jakub Narebski
2012-02-16 14:08 ` [PATCH v4] " Matthieu Moy
2012-02-16 14:15 ` [PATCH v3] " Matthieu Moy
2012-02-16 20:10 ` [PATCH] " Junio C Hamano
2012-02-16 21:04 ` Junio C Hamano
2012-02-17 8:10 ` Matthieu Moy
2012-02-17 13:31 ` Junio C Hamano
2012-02-17 14:19 ` Matthieu Moy
2012-02-17 17:25 ` Junio C Hamano
2012-02-17 18:40 ` Jakub Narebski
2012-02-20 8:50 ` Matthieu Moy
2012-02-20 9:05 ` Junio C Hamano
2012-02-20 12:00 ` Matthieu Moy
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vpq39abrxav.fsf@bauges.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=timhaga@ebene6.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.