Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Tassilo Horn <tassilo <at> member.fsf.org>
Subject: Inverse Search with Evince & DBUS
Newsgroups: gmane.emacs.auctex.general
Date: Saturday 29th January 2011 14:40:20 UTC (over 5 years ago)
Hi all,

I've just gotten inverse search working with Evince (2.32).  That
doesn't have a setting for an editor command (well, it's GNOME, so it
has no settings at all, right?), but instead it fires a SyncSource
signal on the desktop bus.

Well, recent emacsen have dbus support, so it was pretty easy to get
inverse search working.  Here's the code:

--8<---------------cut here---------------start------------->8---
(require 'dbus)

(defun th-evince-sync (file linecol)
  (let ((buf (get-buffer file))
        (line (car linecol))
        (col (cadr linecol)))
    (if (null buf)
        (message "Sorry, %s is not opened..." file)
      (switch-to-buffer buf)
      (goto-line (car linecol))
      (unless (= col -1)
        (move-to-column col)))))

(dbus-register-signal
 :session nil "/org/gnome/evince/Window/0"
 "org.gnome.evince.Window" "SyncSource"
 'th-evince-sync)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo
 
CD: 3ms