Function: TeX-source-correlate-sync-source

TeX-source-correlate-sync-source is a byte-compiled function defined in tex.el.

Signature

(TeX-source-correlate-sync-source FILE LINECOL &rest IGNORED)

Documentation

Show TeX FILE with point at LINECOL.

This function is called when emacs receives a SyncSource signal emitted from the Evince document viewer. IGNORED absorbs an unused id field accompanying the DBUS signal sent by Evince-3.0.0 or newer.

If the Emacs frame isn't raised, customize TeX-raise-frame-function.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-source-correlate-sync-source (file linecol &rest _ignored)
  "Show TeX FILE with point at LINECOL.
This function is called when emacs receives a SyncSource signal
emitted from the Evince document viewer.  IGNORED absorbs an
unused id field accompanying the DBUS signal sent by Evince-3.0.0
or newer.

If the Emacs frame isn't raised, customize
`TeX-raise-frame-function'."
  ;; FILE may be given as relative path to the TeX-master root document or as
  ;; absolute file:// URL.  In the former case, the tex file has to be already
  ;; opened.
  (let* ((file (progn
                 (require 'url-parse)
                 (require 'url-util)
                 (url-unhex-string (aref (url-generic-parse-url file) 6))))
         (flc (or (apply #'TeX-source-correlate-handle-TeX-region file linecol)
                  (apply #'list file linecol)))
         (file (car flc))
         (line (cadr flc))
         (col  (nth 2 flc)))
    (pop-to-buffer (or (find-buffer-visiting file)
                       (find-file-noselect file)))
    (push-mark nil 'nomsg)
    (let ((pos
           (when (> line 0)
             (save-excursion
               (save-restriction
                 (widen)
                 (goto-char 1)
                 (forward-line (1- line))
                 (when (> col 0)
                   (forward-char (1- col)))
                 (point))))))
      (when pos
        (when (or (< pos (point-min))
                  (> pos (point-max)))
          (widen))
        (goto-char pos))
      (when TeX-raise-frame-function
        (funcall TeX-raise-frame-function)))))