[Top][All Lists]

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

[AUCTeX-devel] Re: [AUCTeX] Inverse Search with Evince & DBUS

From: Tassilo Horn
Subject: [AUCTeX-devel] Re: [AUCTeX] Inverse Search with Evince & DBUS
Date: Sun, 06 Feb 2011 20:59:33 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Michael Albinus <address@hidden> writes:


>> I guess, all the options are specific to Evince.
> You could ask for the D-Bus existence of such a viewer. For Evince, I
> would try
> (member
>  "org.gnome.evince.Daemon"
>  (dbus-call-method
>   :session dbus-service-dbus
>   dbus-path-dbus dbus-interface-dbus "ListActivatableNames"))

I think that this is not a proper check, because the evince daemon is
started the first time evince starts (maybe GNOME starts it earlier, but
not every evince user also uses GNOME), so tex.el would need to be
loaded after evince was started the first time.

>>> Do you know if listening to Dbus signals is resource intensive or
>>> has any security implications?  If that's the case we might at least
>>> have to provide a way to switch it off.
>> I don't know.  At least I cannot notice any performance issues on my
>> system.  However, I don't know if it can get resource intensive to
>> dispatch between many messages and signals to pick the one(s) emacs
>> has registered for.  You might want to use `dbus-monitor' to see what
>> goes over the bus.
> If Emacs is built with D-Bus support, the mainloop looks for incoming
> D-Bus events. No further burden, whether you register something, or not.
> When Emacs registers for a signal, exactly *this* signal is sent from
> the D-Bus to Emacs, and no other one. Handling of such a signal might
> last some tenths of a second, but it does not happen often.


Ok, so here's a patch that uses Ralf's pragmatic approach of putting the
stuff simply into `TeX-source-correlate-mode'.

(BTW: Is there any reason to stick to CVS instead of switching to
something modern like git, which savannah also provides?)


Index: ChangeLog
RCS file: /sources/auctex/auctex/ChangeLog,v
retrieving revision 5.1727
diff -r5.1727 ChangeLog
> 2011-02-06  Tassilo Horn  <address@hidden>
>       * tex.el (TeX-source-correlate-mode): Add support for I/O
>       correlation mode inverse search for the Evince document viewer.
Index: tex.el
RCS file: /sources/auctex/auctex/tex.el,v
retrieving revision 5.674
diff -r5.674 tex.el
> (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."
>   (let ((buf (get-buffer 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)))))
>   ;; 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))

reply via email to

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