emacs-devel
[Top][All Lists]
Advanced

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

Re: emacsclient always raise frame (possible regression)


From: Michael Heerdegen
Subject: Re: emacsclient always raise frame (possible regression)
Date: Mon, 29 Jul 2013 10:42:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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 via email to

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