unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: emacs-devel@gnu.org
Cc: Jon Dufresne <jon.dufresne@gmail.com>
Subject: Re: emacsclient always raise frame (possible regression)
Date: Mon, 29 Jul 2013 10:42:34 +0200	[thread overview]
Message-ID: <87mwp5ycxx.fsf@web.de> (raw)
In-Reply-To: CADhq2b4RH-7wgTmo9zwc2-KbjTeoSYp0FB7VD+EShQmt=JybuQ@mail.gmail.com

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.




  reply	other threads:[~2013-07-29  8:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 18:29 emacsclient always raise frame (possible regression) Jon Dufresne
2013-07-29  8:42 ` Michael Heerdegen [this message]
2013-07-29 11:56 ` chad
2013-07-29 15:20   ` Stefan Monnier
2013-07-29 15:44     ` chad
2013-07-29 16:41       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwp5ycxx.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=emacs-devel@gnu.org \
    --cc=jon.dufresne@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).