Skip to content

Instantly share code, notes, and snippets.

@marcelkorpel
Created October 21, 2014 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelkorpel/958c46f2184119fc6d1b to your computer and use it in GitHub Desktop.
Save marcelkorpel/958c46f2184119fc6d1b to your computer and use it in GitHub Desktop.
evince-synctex
post_install() {
echo 'Don not forget to set $EDITORCMD in .bashrc (or similar)'
}
diff --git a/evince b/evince
index 5380585..f42c27f 100755
--- a/evince
+++ b/evince
@@ -1,5 +1,10 @@
#!/bin/sh
-EDITORCMD="gvim --servername '`basename "$1" .pdf`' --remote-silent '+%l<Enter>' %f"
+#EDITORCMD="gvim --servername '`basename "$1" .pdf`' --remote-silent '+%l<Enter>' %f"
+if [ -z "$EDITORCMD" ]; then
+ echo 'Please set variable $EDITORCMD'
+ exit 1
+fi
+
# Highlight matched column
# EDITORCMD="gvim --servername '`basename "$1" .pdf`' --remote-silent '+%l<Enter>:match Search /\%%ll/' %f"
@@ -8,7 +13,7 @@ PDFFILE="$1"
if [ -f "$PDFFILE" ];then
# danke an Feuerfieber
# http://forum.ubuntuusers.de/topic/evince-synctex-vim-emacs-scite-lyx-kile-editor/#post-2841828
- if [ -f "${PDFFILE%%.pdf}.synctex.gz" ];then
+ if [ -f "${PDFFILE%.pdf}.synctex.gz" ];then
evince_backward_search "$PDFFILE" "$EDITORCMD"&
BACKWARD_SEARCH_PID=$!
echo $BACKWARD_SEARCH_PID
diff --git a/evince_backward_search b/evince_backward_search
index 747de5b..d27554d 100755
--- a/evince_backward_search
+++ b/evince_backward_search
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Jose Aliste <jose.aliste@gmail.com>
@@ -104,9 +104,9 @@ class EvinceWindowProxy:
if self._log:
self._log.debug("GetWindowList returned empty list")
- def on_sync_source(self, input_file, source_link):
+ def on_sync_source(self, input_file, source_link, timestamp):
print input_file + ":" + str(source_link[0])
- cmd = re.sub("%f",input_file,self.editor)
+ cmd = re.sub("%f",input_file.split("file://")[1],self.editor)
cmd = re.sub("%l",str(source_link[0]), cmd)
print cmd
subprocess.call(cmd, shell=True)
diff --git a/evince_forward_search b/evince_forward_search
index 420e16a..a0b690a 100755
--- a/evince_forward_search
+++ b/evince_forward_search
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Jose Aliste <jose.aliste@gmail.com>
pkgname=evince-synctex
_pkgname=${pkgname/-/_}
pkgver=1
pkgrel=1
pkgdesc="Several scripts to ease the use of Evince with SyncTeX"
arch=('any')
url="http://forum.ubuntuusers.de/topic/evince-synctex-vim-emacs-scite-lyx-kile-editor/"
license=('GPL')
depends=('python2')
install=$pkgname.install
source=(http://dud.inf.tu-dresden.de/~ben/${_pkgname}.tar.gz
$pkgname.patch)
sha256sums=('65b43f00e894d116bbccf62cac1d6bdd753c6bcb4d0d7f90efbf10c59dc95052'
'5ada6b076ee6b3a01012c2d767ad197d452dcc6591daf65a6054f620adeebbc3')
prepare() {
cd "$srcdir/${_pkgname}"
patch -p1 < ../$pkgname.patch
}
package() {
cd "$srcdir/${_pkgname}"
install -D evince "$pkgdir/usr/bin/$pkgname"
install evince_backward_search "$pkgdir/usr/bin"
install evince_forward_search "$pkgdir/usr/bin"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment