Function: TeX-evince-sync-view-1

TeX-evince-sync-view-1 is a byte-compiled function defined in tex.el.

Signature

(TeX-evince-sync-view-1 DE APP)

Documentation

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-compatible entries in TeX-view-program-list-builtin if the requirements are met.

DE is the name of the desktop environment, APP is the name of viewer.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-evince-sync-view-1 (de app)
  "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-compatible entries in
`TeX-view-program-list-builtin' if the requirements are met.

DE is the name of the desktop environment, APP is the name of
viewer."
  (require 'url-util)
  (let* ((uri (concat "file://"
                      ;; bug#45510: ? in filenames must be escaped as
                      ;; %3F to be a proper URI.
                      (replace-regexp-in-string
                       "[?]" "%3F"
                       (url-encode-url
                        (expand-file-name
                         (TeX-active-master (TeX-output-extension)))))))
         (owner (dbus-call-method
                 :session (format "org.%s.%s.Daemon" de app)
                 (format "/org/%s/%s/Daemon" de app)
                 (format "org.%s.%s.Daemon" de app)
                 "FindDocument"
                 uri
                 t)))
    (if owner
        (with-current-buffer (or (when TeX-current-process-region-p
                                   (get-file-buffer (TeX-region-file t)))
                                 (current-buffer))
          (dbus-call-method
           :session owner
           (format "/org/%s/%s/Window/0" de app)
           (format "org.%s.%s.Window" de app)
           "SyncView"
           (TeX-buffer-file-name)
           (list :struct :int32 (1+ (TeX-current-offset))
                 ;; FIXME: Using `current-column' here is dubious.
                 ;; Most of CJK letters count as occupying 2 columns,
                 ;; so the column number is not equal to the number of
                 ;; the characters counting from the beginning of a
                 ;; line.  What is the right number to specify here?
                 ;; number of letters? bytes in UTF8? or other?
                 :int32 (1+ (current-column)))
           :uint32 0)
          (when TeX-view-evince-keep-focus
            (select-frame-set-input-focus (selected-frame))))
      (error "Couldn't find the %s instance for %s" (capitalize app) uri))))