Mercurial > hgrepos > hgweb.cgi > yatex
comparison yatexprc.el @ 592:86ceef677ca2 draft
Support synctex for evince (thanks to TeX Wiki)
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sat, 24 Sep 2022 12:25:21 +0900 |
parents | 4dad5f91b26c |
children | 0a96c5fef8f1 |
comparison
equal
deleted
inserted
replaced
591:e3b7e199a87d | 592:86ceef677ca2 |
---|---|
1 ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*- | 1 ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*- |
2 ;;; | 2 ;;; |
3 ;;; (c)1993-2019 by HIROSE Yuuji.[yuuji@yatex.org] | 3 ;;; (c)1993-2022 by HIROSE Yuuji.[yuuji@yatex.org] |
4 ;;; Last modified Thu Dec 26 12:48:12 2019 on firestorm | 4 ;;; Last modified Sat Sep 24 12:17:14 2022 on firestorm |
5 ;;; $Id$ | 5 ;;; $Id$ |
6 | 6 |
7 ;;; Code: | 7 ;;; Code: |
8 ;(require 'yatex) | 8 ;(require 'yatex) |
9 (require 'yatexlib) | 9 (require 'yatexlib) |
1147 (progn | 1147 (progn |
1148 (YaTeX-preview-jump-line) | 1148 (YaTeX-preview-jump-line) |
1149 t) ;for YaTeX-goto-corresponding-* | 1149 t) ;for YaTeX-goto-corresponding-* |
1150 nil))) | 1150 nil))) |
1151 | 1151 |
1152 (and (or (featurep 'dbus) (load "dbus" t)) | |
1153 ;; Cannot load dbus on emacs without dbus module | |
1154 (fboundp 'url-unhex-string) | |
1155 (fboundp 'dbus-register-signal) | |
1156 ;; From https://texwiki.texjp.org/?Emacs#vecb4fd9 | |
1157 (progn | |
1158 (fset 'YaTeX-evince-inverse-search | |
1159 (if (fboundp 'evince-inverse) | |
1160 'evince-inverse ;Use previously defined one | |
1161 (function | |
1162 (lambda (file linecol &rest args) | |
1163 (let* ((fn (decode-coding-string | |
1164 (url-unhex-string | |
1165 (if (string-match "^file:///" file) | |
1166 (substring file 7) file)) | |
1167 'utf-8)) | |
1168 (buf (YaTeX-switch-to-buffer fn)) | |
1169 (ln (car linecol)) | |
1170 (col (car (cdr linecol)))) | |
1171 (if (null buf) | |
1172 (error "[Synctex]: Not found [%s]" file) | |
1173 (goto-line ln) | |
1174 (move-to-column (max 0 col)))))))) | |
1175 (dbus-register-signal | |
1176 :session nil "/org/gnome/evince/Window/0" | |
1177 "org.gnome.evince.Window" "SyncSource" | |
1178 'YaTeX-evince-inverse-search))) | |
1179 | |
1152 (defun YaTeX-set-virtual-error-position (file-sym line-sym) | 1180 (defun YaTeX-set-virtual-error-position (file-sym line-sym) |
1153 "Replace the value of FILE-SYM, LINE-SYM by virtual error position." | 1181 "Replace the value of FILE-SYM, LINE-SYM by virtual error position." |
1154 (cond | 1182 (cond |
1155 ((and (get 'dvi2-command 'region) | 1183 ((and (get 'dvi2-command 'region) |
1156 (> (symbol-value line-sym) (car (get 'dvi2-command 'offset)))) | 1184 (> (symbol-value line-sym) (car (get 'dvi2-command 'offset)))) |