From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: cesar mena Newsgroups: gmane.emacs.devel Subject: Re: Raising the Emacs frame in response to a DBUS signal Date: Mon, 30 May 2016 07:36:10 -0400 Message-ID: <8737ozkcb9.fsf@cmena.pobox.com> References: <87eg8krnpv.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1464608246 6954 80.91.229.3 (30 May 2016 11:37:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 30 May 2016 11:37:26 +0000 (UTC) To: Tassilo Horn , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 30 13:37:15 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b7LVQ-0004cV-R8 for ged-emacs-devel@m.gmane.org; Mon, 30 May 2016 13:37:12 +0200 Original-Received: from localhost ([::1]:59474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7LVP-0007pK-W8 for ged-emacs-devel@m.gmane.org; Mon, 30 May 2016 07:37:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7LUc-0007nY-Mj for emacs-devel@gnu.org; Mon, 30 May 2016 07:36:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7LUX-0002tP-Mi for emacs-devel@gnu.org; Mon, 30 May 2016 07:36:21 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7LUW-0002tA-Cd; Mon, 30 May 2016 07:36:17 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 51855209E5; Mon, 30 May 2016 07:36:12 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Mon, 30 May 2016 07:36:12 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=h/RcjLPRkxrW/gZtf8EnbnUktfI=; b=NNHby SI77xAD319hNxTG/C135CSUWMX+QYi4dviZVMsKpWKP5DBoIeN1hE4kMhLfjV31r dWzRPmZNkErNXfUG9K3ZYaRvV7sPebZcoZZ+04pG3KqTDKCF1uZzbleuG39OVDEV GfZgMRwn0UXUSwqXrMUAZUno4Z18w5HpBhpEQM= X-Sasl-enc: t5ksZQUKy9RmwYkbpg5V2nH0X3q3tVPpDbisnBhWrQ1D 1464608172 Original-Received: from [127.0.1.1] (pool-96-255-229-158.washdc.fios.verizon.net [96.255.229.158]) by mail.messagingengine.com (Postfix) with ESMTPA id 08C62CCD3A; Mon, 30 May 2016 07:36:12 -0400 (EDT) In-Reply-To: <87eg8krnpv.fsf@gnu.org> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204145 Archived-At: Tassilo Horn 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 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