emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex 6dcf0e1 18/42: Add a new option for evince compa


From: Tassilo Horn
Subject: [elpa] externals/auctex 6dcf0e1 18/42: Add a new option for evince compatible viewer.
Date: Thu, 23 Nov 2017 06:06:11 -0500 (EST)

branch: externals/auctex
commit 6dcf0e1083791902563afaac9add4211bd91514a
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>

    Add a new option for evince compatible viewer.
    
    * tex.el: (TeX-view-evince-keep-focus): New option.
    (TeX-evince-sync-view-1): Pull the focus back to Emacs if the above
    new option is non-nil.
---
 tex.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tex.el b/tex.el
index e4012b0..d1b7791 100644
--- a/tex.el
+++ b/tex.el
@@ -1305,6 +1305,15 @@ entry in `TeX-view-program-list-builtin'."
       (pop-to-buffer (or (find-buffer-visiting pdf)
                         (find-file-noselect pdf))))))
 
+(defcustom TeX-view-evince-keep-focus nil
+  "Whether Emacs retains the focus when viewing PDF files with Evince.
+
+When calling `TeX-evince-sync-view', Evince normally captures the
+focus. If this option is set to non-nil, Emacs will retain the
+focus."
+  :group 'TeX-view
+  :type 'boolean)
+
 (defvar url-unreserved-chars)
 
 (defun TeX-evince-sync-view-1 (de app)
@@ -1344,7 +1353,14 @@ viewer."
                 ;; line.  What is the right number to specify here?
                 ;; number of letters? bytes in UTF8? or other?
                 :int32 (1+ (current-column)))
-          :uint32 0))
+          :uint32 0)
+          (when TeX-view-evince-keep-focus
+           (cond ((fboundp #'select-frame-set-input-focus)
+                  (select-frame-set-input-focus (selected-frame)))
+                 ((fboundp #'x-focus-frame)
+                  (x-focus-frame (selected-frame)))
+                 ((fboundp #'focus-frame)
+                  (focus-frame (selected-frame))))))
       (error "Couldn't find the %s instance for %s" (capitalize app) uri))))
 
 (defun TeX-atril-sync-view ()



reply via email to

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