[Top][All Lists]

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

[AUCTeX-devel] Bring back the focus to emacs from viewer (was Re: [PATCH

From: Ikumi Keita
Subject: [AUCTeX-devel] Bring back the focus to emacs from viewer (was Re: [PATCH] When using SyncTeX with Evince, do not switch focus after syncing.)
Date: Fri, 29 Sep 2017 22:05:31 +0900

>>>>> Mosè Giordano <address@hidden> writes:
>>>>>>> Ikumi Keita <address@hidden> writes:
>> 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".

> The patch looks good, but... doesn't work for me, at least with
> Okular.  Instead it works with Evince.

Hmm...then, it might be necessary to wait a little before trying to
bring back the focus.  Unlike Evince, Okular is called with normal
`TeX-run-discard' hook and runs asynchoronously, so the function
`select-frame-set-input-focus' in question might run too early, when
okular is not yet ready.

If this speculation is right, this kind of treatment is valid for okular?
    (when (and TeX-view-keep-focus
               (string= name "View"))
      (sit-for 0.3)
      (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)))))))

>> In this patch, the user option is renamed from
>> `TeX-view-evince-keep-focus' to `TeX-view-keep-focus'.

> Good idea.

OK, then let's take this approach about this aspect.

Ikumi Keita

reply via email to

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