Hi all,

>>>>> Ikumi Keita <ik...@ikumi.que.jp> writes:
> Hi Mosè,
>>>>> Mosè Giordano <m...@gnu.org> writes:
>> Hi Keita,
>> the same feature has been asked for Okular on TeX.se:
>> https://emacs.stackexchange.com/q/35788/620  Is there any chance to
>> generalize it to any viewer?

> OK, I'll take a look and see if it is possible in a clean manner.

I think the attached patch does the supposed job basically.  It inserts
addtional process at the end of `TeX-command' and brings the focus back
to emacs if the relavant user option is non-nil and the command is
"View".  In this patch, the user option is renamed from
`TeX-view-evince-keep-focus' to `TeX-view-keep-focus'.

How do you think about this?

Regards,
Ikumi Keita

--- tex-buf.el~	2017-09-29 01:14:51.554511000 +0900
+++ tex-buf.el	2017-09-29 01:22:41.640439000 +0900
@@ -540,7 +540,16 @@
     ;; Now start the process
     (setq file (funcall file))
     (TeX-process-set-variable file 'TeX-command-next TeX-command-Show)
-    (funcall hook name command file)))
+    (funcall hook name command file)
+
+    (if (and TeX-view-keep-focus
+	     (string= name "View"))
+	    (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)))))))
 
 (defvar TeX-command-text)               ;Dynamically scoped.
 (defvar TeX-command-pos)                ;Dynamically scoped.
_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to