2016-02-10 6:22 GMT+01:00 Tassilo Horn <[email protected]>:
> Hi,
>
> Yes, I'll have a look but probably not today anymore.
Well, probably having the patch really attached would be better ;-)
Antoine suggested me privately to name the variable `TeX-evince-name',
that's fine with me.
Bye,
Mosè
diff --git a/tex.el b/tex.el
index 3c11786..ee7f29d 100644
--- a/tex.el
+++ b/tex.el
@@ -1178,6 +1178,29 @@ The following built-in predicates are available:
:group 'TeX-view
:type '(alist :key-type symbol :value-type (group sexp)))
+(defcustom TeX-evince-gnome '("evince" "gnome")
+ "List of strings with the name of Evince and GNOME.
+
+There is a fork of the GNOME desktop environment, MATE, shipping
+a fork of the Evince viewer, Atril, but the interface is almost
+the same as Evince in GNOME. This option holds the name of both
+the viewer and the desktop environment that will be used to start
+the program and the DBUS communications.
+
+The first element of the list is the viewer, the second is the
+desktop environment.
+
+The names should be lowercase."
+ :group 'TeX-view
+ :type '(choice
+ (const :tag "Evince and GNOME"
+ ("evince" "gnome"))
+ (const :tag "Atril and MATE"
+ ("atril" "mate"))
+ (list :tag "Other"
+ (string :tag "Viewer")
+ (string :tag "Desktop environment"))))
+
;; Require dbus at compile time to prevent errors due to `dbus-ignore-errors'
;; not being defined.
(eval-when-compile (and (featurep 'dbusbind)
@@ -1193,13 +1216,22 @@ search are checked, too."
(and (featurep 'dbusbind)
(require 'dbus nil :no-error)
(dbus-ignore-errors (dbus-get-unique-name :session))
- (dbus-ping :session "org.gnome.evince.Daemon")
- (executable-find "evince")
+ (dbus-ping :session
+ (format "org.%s.%s.Daemon" (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome)))
+ (executable-find (car TeX-evince-gnome))
(or (not (memq :forward options))
(let ((spec (dbus-introspect-get-method
- :session "org.gnome.evince.Daemon"
- "/org/gnome/evince/Daemon"
- "org.gnome.evince.Daemon"
+ :session
+ (format "org.%s.%s.Daemon"
+ (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome))
+ (format "/org/%s/%s/Daemon"
+ (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome))
+ (format "org.%s.%s.Daemon"
+ (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome))
"FindDocument")))
;; FindDocument must exist, and its signature must be (String,
;; Boolean, String). Evince versions between 2.30 and 2.91.x
@@ -1246,9 +1278,16 @@ the requirements are met."
(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"
+ :session
+ (format "org.%s.%s.Daemon"
+ (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome))
+ (format "/org/%s/%s/Daemon"
+ (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome))
+ (format "org.%s.%s.Daemon"
+ (cadr TeX-evince-gnome)
+ (car TeX-evince-gnome))
"FindDocument"
uri
t)))
@@ -1258,13 +1297,17 @@ the requirements are met."
(current-buffer))
(dbus-call-method
:session owner
- "/org/gnome/evince/Window/0"
- "org.gnome.evince.Window"
+ (format "/org/gnome/evince/Window/0"
+ (cadr TeX-evince-gnome) (car TeX-evince-gnome))
+ (format "org.%s.%s.Window"
+ (cadr TeX-evince-gnome) (car TeX-evince-gnome))
"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))))
+ ;; Atril doesn't want this addional argument.
+ (when (equal "evince" (car TeX-evince-gnome)) :uint32 0)))
+ (error "Couldn't find the %s instance for %s"
+ (capitalize (car TeX-evince-gnome)) uri))))
(defvar TeX-view-program-list-builtin
(cond
@@ -1299,13 +1342,16 @@ the requirements are met."
("xpdf" ("xpdf -remote %s -raise %o" (mode-io-correlate " %(outpage)")) "xpdf")
("Evince" ,(if (TeX-evince-dbus-p :forward)
'TeX-evince-sync-view
- `("evince" (mode-io-correlate
- ;; With evince 3, -p N opens the page *labeled* N,
- ;; and -i,--page-index the physical page N.
- ,(if (string-match "--page-index"
- (shell-command-to-string "evince --help"))
- " -i %(outpage)"
- " -p %(outpage)")) " %o")) "evince")
+ `(,(car TeX-evince-gnome)
+ (mode-io-correlate
+ ;; With evince 3, -p N opens the page *labeled* N,
+ ;; and -i,--page-index the physical page N.
+ ,(if (string-match "--page-index"
+ (shell-command-to-string
+ (format "%s --help"
+ (car TeX-evince-gnome))))
+ " -i %(outpage)"
+ " -p %(outpage)")) " %o")) ,(car TeX-evince-gnome))
("Okular" ("okular --unique %o" (mode-io-correlate "#src:%n%a")) "okular")
("xdg-open" "xdg-open %o" "xdg-open")
("PDF Tools" TeX-pdf-tools-sync-view)
@@ -1313,7 +1359,7 @@ the requirements are met."
("zathura %o"
(mode-io-correlate
" --synctex-forward %n:0:%b -x \"emacsclient +%{line} %{input}\""))
- "zathura"))))
+ "zathura"))))
"Alist of built-in viewer specifications.
This variable should not be changed by the user who can use
`TeX-view-program-list' to add new viewers or overwrite the
@@ -1824,8 +1870,12 @@ SyncTeX are recognized."
;; Register Emacs for the SyncSource DBUS signal emitted by Evince.
(when (TeX-evince-dbus-p)
(dbus-register-signal
- :session nil "/org/gnome/evince/Window/0"
- "org.gnome.evince.Window" "SyncSource"
+ :session nil
+ (format "/org/%s/%s/Window/0"
+ (cadr TeX-evince-gnome) (car TeX-evince-gnome))
+ (format "org.%s.%s.Window"
+ (cadr TeX-evince-gnome) (car TeX-evince-gnome))
+ "SyncSource"
'TeX-source-correlate-sync-source)))
(defalias 'TeX-source-specials-mode 'TeX-source-correlate-mode)
_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex