auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] Changes to auctex/tex.el,v


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/tex.el,v
Date: Sun, 27 Mar 2011 13:23:17 +0000

CVSROOT:        /cvsroot/auctex
Module name:    auctex
Changes by:     Ralf Angeli <angeli>    11/03/27 13:23:16

Index: tex.el
===================================================================
RCS file: /cvsroot/auctex/auctex/tex.el,v
retrieving revision 5.674
retrieving revision 5.675
diff -u -b -r5.674 -r5.675
--- tex.el      30 Jan 2011 16:24:15 -0000      5.674
+++ tex.el      27 Mar 2011 13:23:16 -0000      5.675
@@ -1413,6 +1413,22 @@
   "Keymap for `TeX-source-correlate-mode'.
 You could use this for unusual mouse bindings.")
 
+(defun TeX-source-correlate-sync-source (file linecol)
+  "Show TeX FILE with point at LINECOL.
+This function is called when emacs receives a SyncSource signal
+emitted from the Evince document viewer."
+  ;; FILE is actually given as relative path to the TeX-master root document,
+  ;; so we need to strip the directory part to match the buffer name.
+  (let ((buf (get-buffer (file-name-nondirectory file)))
+        (line (car linecol))
+        (col (cadr linecol)))
+    (if (null buf)
+        (message "No buffer for %s." file)
+      (switch-to-buffer buf)
+      (goto-line (car linecol))
+      (unless (= col -1)
+        (move-to-column col)))))
+
 (define-minor-mode TeX-source-correlate-mode
   "Minor mode for forward and inverse search.
 
@@ -1434,6 +1450,15 @@
                                       TeX-source-correlate-map))
   (TeX-set-mode-name 'TeX-source-correlate-mode t t)
   (setq TeX-source-correlate-start-server-flag TeX-source-correlate-mode)
+  ;; Register Emacs for the SyncSource DBUS signal emitted by Evince.
+  (when (and (fboundp 'dbus-register-signal)
+            (fboundp 'dbus-call-method)
+            (executable-find "evince"))
+    (require 'dbus)
+    (dbus-register-signal
+     :session nil "/org/gnome/evince/Window/0"
+     "org.gnome.evince.Window" "SyncSource"
+     'TeX-source-correlate-sync-source))
   (unless TeX-source-correlate-method-active
     (setq TeX-source-correlate-method-active
          (if (eq TeX-source-correlate-method 'auto)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]