From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: emacsclient always raise frame (possible regression) Date: Mon, 29 Jul 2013 10:42:34 +0200 Message-ID: <87mwp5ycxx.fsf@web.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1375087393 18204 80.91.229.3 (29 Jul 2013 08:43:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Jul 2013 08:43:13 +0000 (UTC) Cc: Jon Dufresne To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 29 10:43:12 2013 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 1V3j2s-0005XQ-Tk for ged-emacs-devel@m.gmane.org; Mon, 29 Jul 2013 10:43:11 +0200 Original-Received: from localhost ([::1]:50636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3j2s-0002f3-HT for ged-emacs-devel@m.gmane.org; Mon, 29 Jul 2013 04:43:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3j2j-0002er-Fw for emacs-devel@gnu.org; Mon, 29 Jul 2013 04:43:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3j2b-0001qF-OA for emacs-devel@gnu.org; Mon, 29 Jul 2013 04:43:01 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3j2b-0001q9-Ht for emacs-devel@gnu.org; Mon, 29 Jul 2013 04:42:53 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V3j2Y-0005LN-Kr for emacs-devel@gnu.org; Mon, 29 Jul 2013 10:42:50 +0200 Original-Received: from ip-90-186-220-191.web.vodafone.de ([90.186.220.191]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 29 Jul 2013 10:42:50 +0200 Original-Received: from michael_heerdegen by ip-90-186-220-191.web.vodafone.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 29 Jul 2013 10:42:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 55 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-90-186-220-191.web.vodafone.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:l5VQMSSe50O0Rk7wZQOyktZ+whw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162233 Archived-At: Hi Jon, > I recently updated my system to Fedora 19. Fedora 19 packages Gnome > 3.8 and Emacs 24.2.1. > > I run Emacs in daemon mode. When using tools such as mercurial or git > from the command line, an editor is invoked with the command > "emacsclient -c FILENAME". When this editor is invoked I want the > newly created frame immediately raised to the top of Gnome's window > stack so I may interact with it. > > In previous Fedora/Emacs versions I achieved this with the following > in my init.el > > (add-hook 'after-make-frame-functions >           (lambda (frame) >             (raise-frame frame))) > > This no longer works. Now whenever mercurial invokes the editor the > frame remains at the bottom of the stack of windows. > > First off, should this elisp do what I'm trying to do? Dunno. AFAIK, it can happen that the newly created frame is not yet displayed (i.e., created by X) when `after-make-frame-functions' are called. Try to use a delay, like this: (add-hook 'after-make-frame-functions (lambda (frame) (run-with-idle-timer 1. nil 'raise-frame frame))) > Is this a regression in Emacs or an issue with Gnome? If this is > wrong, what is the correct way to always raise new frames? Note that `raise-frame' doesn't make the frame "current". Maybe Gnome raises the frame that has focus automatically? Then you want `select-frame-set-input-focus' instead of `raise-frame'. If your problem is specific to emacsclient invocations, it is probably better to configure `server-window' instead of `after-make-frame-functions'. This is what I do: (setq server-window (lambda (buf) (let ((win (display-buffer-pop-up-frame buf ()))) (select-frame-set-input-focus (window-frame win))))) Hope one of the above proposals helps. Regards, Michael.