unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Intercepting windowClosed (OS X or in general)
@ 2005-05-02 11:16 David Reitter
  2005-05-02 19:05 ` Kevin Rodgers
  0 siblings, 1 reply; 7+ messages in thread
From: David Reitter @ 2005-05-02 11:16 UTC (permalink / raw)


Hi,

how would one intercept handling of windowClosed events, that is, when 
a user clicks the closer button to delete a frame. I would ideally like 
to advise a function to do something special or use a hook.

This would be on the OS X port (but a generic solution would do, too, 
of course).

Thanks!

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

* Re: Intercepting windowClosed (OS X or in general)
  2005-05-02 11:16 Intercepting windowClosed (OS X or in general) David Reitter
@ 2005-05-02 19:05 ` Kevin Rodgers
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2005-05-02 19:05 UTC (permalink / raw)


David Reitter wrote:
 > how would one intercept handling of windowClosed events, that is, when
 > a user clicks the closer button to delete a frame. I would ideally
 > like to advise a function to do something special or use a hook.

See the "Misc(ellaneous Window System) Events" node of the Emacs Lisp
manual:

|   A few other event types represent occurrences within the window
| ystem.
|
| (delete-frame (FRAME))'
|     This kind of event indicates that the user gave the window manager
|     a command to delete a particular window, which happens to be an
|     Emacs frame.
|
|     The standard definition of the `delete-frame' event is to delete
|      FRAME.

-- 
Kevin Rodgers

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

* Re: Intercepting windowClosed (OS X or in general)
       [not found] <mailman.464.1115054139.2819.help-gnu-emacs@gnu.org>
@ 2005-05-03 23:26 ` Stefan Monnier
  2005-05-04 21:57   ` David Reitter
       [not found]   ` <mailman.3349.1115245914.2819.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2005-05-03 23:26 UTC (permalink / raw)


> how would one intercept handling of windowClosed events, that is, when
> a user clicks the closer button to delete a frame. I would ideally like to
> advise a function to do something special or use a hook.

delete-frame-hook, maybe?


        Stefan

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

* Re: Intercepting windowClosed (OS X or in general)
  2005-05-03 23:26 ` Stefan Monnier
@ 2005-05-04 21:57   ` David Reitter
  2005-05-05 17:18     ` Kevin Rodgers
       [not found]   ` <mailman.3349.1115245914.2819.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 7+ messages in thread
From: David Reitter @ 2005-05-04 21:57 UTC (permalink / raw)


Stefan Monnier  writes:

> > how would one intercept handling of windowClosed events, that is, when
> > a user clicks the closer button to delete a frame. I would ideally like to
> > advise a function to do something special or use a hook.
> 
> delete-frame-hook, maybe?

Thanks, but I assume this would be fired when a frame is deleted automatically, 
too. I think there's a function to check if it was a mouse event, right?

But I found an easier way - that is to redefine handle-delete-frame to do what 
I want.

Works. (For now, at least.)

Oh, is there a list of *all* hooks somewhere? This delete-frame-hook is not 
listed on the "standard hooks" page of the elisp manual. Or, search 
documentation for .*-hooks? ?

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

* Re: Intercepting windowClosed (OS X or in general)
  2005-05-04 21:57   ` David Reitter
@ 2005-05-05 17:18     ` Kevin Rodgers
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2005-05-05 17:18 UTC (permalink / raw)


David Reitter wrote:
 > Stefan Monnier  writes:
 >>>how would one intercept handling of windowClosed events, that is, when
 >>>a user clicks the closer button to delete a frame. I would ideally 
like to
 >>>advise a function to do something special or use a hook.
 >>
 >>delete-frame-hook, maybe?
 >
 > Thanks, but I assume this would be fired when a frame is deleted
 > automatically, too. I think there's a function to check if it was a
 > mouse event, right?

C-h v last-input-event
C-h v last-command-event
C-h f event-basic-type

 > But I found an easier way - that is to redefine handle-delete-frame to
 > do what I want.
 >
 > Works. (For now, at least.)

Redefined via defadvice, I hope.

 > Oh, is there a list of *all* hooks somewhere? This delete-frame-hook
 > is not listed on the "standard hooks" page of the elisp manual. Or,
 > search documentation for .*-hooks? ?

M-x apropos-variable RET -hook\'

-- 
Kevin Rodgers

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

* Re: Intercepting windowClosed (OS X or in general)
       [not found]   ` <mailman.3349.1115245914.2819.help-gnu-emacs@gnu.org>
@ 2005-05-06  3:30     ` Stefan Monnier
  2005-05-06  9:26       ` Thien-Thi Nguyen
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2005-05-06  3:30 UTC (permalink / raw)


>> delete-frame-hook, maybe?

> Thanks, but I assume this would be fired when a frame is deleted
> automatically,  too. I think there's a function to check if it was a mouse
> event, right?

I'm not sure what you mean by "automatically", but if you only want to catch
the "press the delete button in the WM", then try to change the binding for
the delete-frame event in special-event-map (defaults to
handle-delete-frame).

> But I found an easier way - that is to redefine handle-delete-frame to do
> what I want.

That's less elegant.

> Oh, is there a list of *all* hooks somewhere?

It's an ill-defined concept, there's an infinity of hooks.

> This delete-frame-hook is not  listed on the "standard hooks" page of the
> elisp manual. Or, search  documentation for .*-hooks? ?

I found the above one with M-x apropos RET frame.*hook RET


        Stefan

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

* Re: Intercepting windowClosed (OS X or in general)
  2005-05-06  3:30     ` Stefan Monnier
@ 2005-05-06  9:26       ` Thien-Thi Nguyen
  0 siblings, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2005-05-06  9:26 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

> It's an ill-defined concept, there's an infinity of hooks.

there's also an infinity of non-hooks.

thi

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

end of thread, other threads:[~2005-05-06  9:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-02 11:16 Intercepting windowClosed (OS X or in general) David Reitter
2005-05-02 19:05 ` Kevin Rodgers
     [not found] <mailman.464.1115054139.2819.help-gnu-emacs@gnu.org>
2005-05-03 23:26 ` Stefan Monnier
2005-05-04 21:57   ` David Reitter
2005-05-05 17:18     ` Kevin Rodgers
     [not found]   ` <mailman.3349.1115245914.2819.help-gnu-emacs@gnu.org>
2005-05-06  3:30     ` Stefan Monnier
2005-05-06  9:26       ` Thien-Thi Nguyen

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).