all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* focusing a frame
@ 2003-01-30 18:26 Kenneth Vestergaard Schmidt
  2003-02-01 11:03 ` Kenneth Vestergaard Schmidt
  2003-02-02  2:33 ` Unknown
  0 siblings, 2 replies; 4+ messages in thread
From: Kenneth Vestergaard Schmidt @ 2003-01-30 18:26 UTC (permalink / raw)


Hello.

I've tried getting my Emacs to focus a frame when emacsclient is
invoked. I've added this snippet to my .emacs:

(setq-default main-frame (selected-frame))
(add-hook 'server-visit-hook '(lambda ()
	  (if emacs-iconified (iconify-or-deiconify-frame))
	  (raise-frame main-frame)
	  (x-focus-frame main-frame)
))

This works in all cases, except when I iconify Emacs with C-z. If I
invoke emacsclient, all I get is an:

       X protocol error: BadMatch (invalid parameter attributes) on
       protocol request 42

and a *woosh* as Emacs dies.

What am I doing wrong? I tried using (other-frame 0) instead of
(x-focus-frame main-frame), but that made no difference. Commenting
that line out entirely also prevents the crashes, but also prevents
Emacs from gaining focus, which is what I really would like.

For the record, I'm using Emacs 21.2 on a Debian GNU/Linux (unstable)
system.

-- 
Best Regards

Kenneth Vestergaard Schmidt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: focusing a frame
  2003-01-30 18:26 focusing a frame Kenneth Vestergaard Schmidt
@ 2003-02-01 11:03 ` Kenneth Vestergaard Schmidt
  2003-02-02  5:46   ` Eli Zaretskii
  2003-02-02  2:33 ` Unknown
  1 sibling, 1 reply; 4+ messages in thread
From: Kenneth Vestergaard Schmidt @ 2003-02-01 11:03 UTC (permalink / raw)


On Thu, Jan 30, 2003 at 06:26:14PM +0000, Kenneth Vestergaard Schmidt wrote:
> This works in all cases, except when I iconify Emacs with C-z. If I
> invoke emacsclient, all I get is an:
> 
>        X protocol error: BadMatch (invalid parameter attributes) on
>        protocol request 42
> 
> and a *woosh* as Emacs dies.

Just for the off incident that somebody would actually be searching
for the same problem - it seems the problem can be alleviated by
pausing between the (raise-frame) and (x-focus-frame) commands, eg:

	(raise-frame nil)
	(sleep-for 0.5)
	(x-focus-frame nil)

I haven't tested this extensively, though, so maybe Emacs would still
crash if the machine was under heavy load and didn't get to respond to
the raise-request within the 0.5 sec pause. No matter what, it's still
an ugly hack, but at least it keeps my Emacs from crashing :-)

/Kenneth

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: focusing a frame
  2003-01-30 18:26 focusing a frame Kenneth Vestergaard Schmidt
  2003-02-01 11:03 ` Kenneth Vestergaard Schmidt
@ 2003-02-02  2:33 ` Unknown
  1 sibling, 0 replies; 4+ messages in thread
From: Unknown @ 2003-02-02  2:33 UTC (permalink / raw)


Kenneth Vestergaard Schmidt wrote:

> Hello.
> 
> I've tried getting my Emacs to focus a frame when emacsclient is
> invoked. I've added this snippet to my .emacs:
> 
> (setq-default main-frame (selected-frame))
> (add-hook 'server-visit-hook '(lambda ()
> (if emacs-iconified (iconify-or-deiconify-frame))
> (raise-frame main-frame)
> (x-focus-frame main-frame)
> ))
> 
> This works in all cases, except when I iconify Emacs with C-z. If I
> invoke emacsclient, all I get is an:
> 
>        X protocol error: BadMatch (invalid parameter attributes) on
>        protocol request 42
> 
> and a *woosh* as Emacs dies.
> 
> What am I doing wrong?

Maybe you can try using `select-frame-set-input-focus' instead of 
`x-focus-frame'?

--
Le

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: focusing a frame
  2003-02-01 11:03 ` Kenneth Vestergaard Schmidt
@ 2003-02-02  5:46   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2003-02-02  5:46 UTC (permalink / raw)



On Sat, 1 Feb 2003, Kenneth Vestergaard Schmidt wrote:

> On Thu, Jan 30, 2003 at 06:26:14PM +0000, Kenneth Vestergaard Schmidt wrote:
> > This works in all cases, except when I iconify Emacs with C-z. If I
> > invoke emacsclient, all I get is an:
> > 
> >        X protocol error: BadMatch (invalid parameter attributes) on
> >        protocol request 42
> > 
> > and a *woosh* as Emacs dies.
> 
> Just for the off incident that somebody would actually be searching
> for the same problem - it seems the problem can be alleviated by
> pausing between the (raise-frame) and (x-focus-frame) commands, eg:
> 
> 	(raise-frame nil)
> 	(sleep-for 0.5)
> 	(x-focus-frame nil)

Please report this bug to gnu.emacs.bug.  That is the only sure way to 
get this fixed in some future release.

TIA

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-02  5:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-30 18:26 focusing a frame Kenneth Vestergaard Schmidt
2003-02-01 11:03 ` Kenneth Vestergaard Schmidt
2003-02-02  5:46   ` Eli Zaretskii
2003-02-02  2:33 ` Unknown

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.