bug-auctex
[Top][All Lists]
Advanced

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

Re: [Bug-AUCTeX] TeX-evince-sync-view


From: Tassilo Horn
Subject: Re: [Bug-AUCTeX] TeX-evince-sync-view
Date: Wed, 04 Sep 2013 16:35:25 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Thomas Arildsen <address@hidden> writes:

Hi Thomas,

>> AUCTeX first does
>>
>> (dbus-call-method
>>   :session "org.gnome.evince.Daemon"
>>   "/org/gnome/evince/Daemon"
>>   "org.gnome.evince.Daemon"
>>   "FindDocument"
>>   "file:///home/horn/some.pdf"   ;; replace with some existing PDF
>>   t) ;; C-x C-x here
>>
>> Does that work, i.e., open an evince window showing some.pdf?
> This part works, much to my surprise. I pasted the above into the
> scratch buffer, replaced by an existing PDF and ran M-x
> eval-buffer. The PDF opened in a new evince window.

Uh, that's strange.  That's exactly what TeX-evince-sync-view does.

> When I then run the TeX-evince-sync-view command on a LaTeX document
> (that has a newly compiled PDF output), nothing happens: no evince
> windows, no error message, no output from 'dbus-monitor', no output in
> the *Messages* buffer - nothing...

Hm, so TeX-evince-sync-view is called, doesn't error, and still does
nothing.  Honestly, I have no clue how that can happen.  Could you
please do `C-h f TeX-evince-sync-view RET' which shows the docs of the
function.  It should look like

,----[ C-h f TeX-evince-sync-view RET ]
| TeX-evince-sync-view is a Lisp function in `tex.el'.
| 
| (TeX-evince-sync-view)
| 
| Focus the focused page/paragraph in Evince with the position
| of point in emacs by using Evince's DBUS API.  Used by default
| for the Evince viewer entry in `TeX-view-program-list-builtin' if
| the requirements are met.
| 
| [back]
`----

There, the `tex.el' is a link.  Hitting RET on it brings you to the
definition of the function.  It should look like

--8<---------------cut here---------------start------------->8---
(defun TeX-evince-sync-view ()
  "Focus the focused page/paragraph in Evince with the position
of point in emacs by using Evince's DBUS API.  Used by default
for the Evince viewer entry in `TeX-view-program-list-builtin' if
the requirements are met."
  (require 'url-util)
  (let* ((uri (concat "file://" (let ((url-unreserved-chars (cons ?/ 
url-unreserved-chars)))
                                  (url-hexify-string
                                   (expand-file-name
                                    (concat file "." 
(TeX-output-extension)))))))
         (owner (dbus-call-method
                 :session "org.gnome.evince.Daemon"
                 "/org/gnome/evince/Daemon"
                 "org.gnome.evince.Daemon"
                 "FindDocument"
                 uri
                 t)))
    (if owner
        (dbus-call-method
         :session owner
         "/org/gnome/evince/Window/0"
         "org.gnome.evince.Window"
         "SyncView"
         (buffer-file-name)
         (list :struct :int32 (line-number-at-pos) :int32 (1+ (current-column)))
         :uint32 0)
      (error "Couldn't find the Evince instance for %s" uri))))
--8<---------------cut here---------------end--------------->8---

Now set point somewhere in the function and do `M-x edebug-defun'.  Now
go to some tex buffer and try the View command with TeX-evince-sync-view
again.  Now the function definition should pop up again, and you can
single-step through the function by repeatedly pressing `n' where the
expression values are also printed in *Messages*.

Does that share some light?

Bye,
Tassilo




reply via email to

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