emacs-devel
[Top][All Lists]
Advanced

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

Re: Raising the Emacs frame in response to a DBUS signal


From: cesar mena
Subject: Re: Raising the Emacs frame in response to a DBUS signal
Date: Mon, 30 May 2016 07:36:10 -0400
User-agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu)

Tassilo Horn <address@hidden> writes:

> Hi all,
>
> GNU AUCTeX supports inverse search for the Evince PDF viewer, i.e., when
> you're writing a LaTeX document with Emacs/AUCTeX and view the compiled
> PDF using Evince, you can Ctrl-click in Evince and Emacs jumps to the
> corresponding text in your LaTeX editing buffer.  For that purpose,
> Emacs is registered to handle SyncSource DBUS signals issued by Evince.
>
> Since recently (no clue when as I normally don't use Evince but the PDF
> Tools Emacs PDF viewer) in Emacs 25, the Emacs frame is not raised
> anymore when the AUCTeX function handling the SyncSource signal is
> called, and the problem is that I don't know how to achieve that again.
>
> `raise-frame' seems to raise the selected frame above other Emacs frames
> of the same Emacs instance but not above other applications (like
> Evince).  Here in Gnome 3.20, I get at least a notification "Emacs is
> ready" which I can click to switch to Emacs.  But the user who reported
> the problem uses XFCE where nothing seems to happen.  Or better, point
> in Emacs jumps to the right position but he has to switch to Emacs
> explicitly.
>
> Then I found `x-focus-frame' which seems to do what I want.  A simple
> test case like evaluating
>
>   (progn
>     (sleep-for 5)
>     (x-focus-frame (selected-frame)))
>
> in *scratch* and then switching to another application brings Emacs to
> the front again when the 5 seconds have passed.  However, when I add the
> very same `x-focus-frame' call to the end of the AUCTeX SyncSource DBUS
> handler function, it seems to have no effect.  The function is run and
> switches to the right LaTeX editing buffer and sets point, but Emacs
> the Emacs frame is not raised.
>
> That's the actual function:
>
>   http://git.savannah.gnu.org/cgit/auctex.git/tree/tex.el#n1849
>
> In some previous version of the function I've called `raise-frame' at
> the end but eventually removed that call.  Sadly, I'm don't know anymore
> why I did that.  Either because the frame was raised anyhow or because
> it didn't raise.
>
> I checked the ChangeLogs but couldn't find some change which looks
> relevant.
>
> Bye,
> Tassilo

hi,

see if the below advise works for you. it uses wmctrl to raise the
frame. there's an explanation in the gmane article linked in the comment.

   (defadvice raise-frame (after make-it-work (&optional frame) activate)
     "Work around some bug? in raise-frame/Emacs/GTK/Metacity/something.
      Katsumi Yamaoka <address@hidden> posted this in 
      http://article.gmane.org/gmane.emacs.devel:39702";
      (call-process
       "wmctrl" nil nil nil "-i" "-R"
       (frame-parameter (or frame (selected-frame)) 'outer-window-id)))

-cm



reply via email to

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