all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to make emacs prompt me before closing the last emacs gui frame when running emacs as a daemon?
@ 2017-02-05  2:34 Filipe Silva
  0 siblings, 0 replies; 2+ messages in thread
From: Filipe Silva @ 2017-02-05  2:34 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

I now that if I set:

    (setq confirm-kill-emacs 'y-or-n-p)

Then Emacs prompts me before I *kill* it.

But I want emacs to prompt me before I close my last gui frame (prompting
me before killing any frame would be very helpful already).
When you run emacs in daemon-mode, closing the last gui frame does not kill
emacs and thus the aforementioned setting does not work.

The problem is that sometimes I overpress my keybind to quit emacs windows
(evil-quit) and I endup quiting also my current gui frame,
which is annoying.

I know that before deleting the frame, emacs runs the functions that are
listed in the variable delete-frame-functions,
so I thought I could include a function there that would prompt me to query
if I really wanted to kill the frame.
But it is not clear from the documentation what I would have to do inside
that function to stop the process of killing the frame.

Another idea would be to add an advice to evil-quit, like: if daemon-p is t
then evil-quit have to prompt me to quit my current frame.
Or Something like that?

ps: I run GUI emacs from both OSx and GNU/Linux.

Thanks in advance!


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

* Re: how to make emacs prompt me before closing the last emacs gui frame when running emacs as a daemon?
@ 2017-02-05  9:15 martin rudalics
  0 siblings, 0 replies; 2+ messages in thread
From: martin rudalics @ 2017-02-05  9:15 UTC (permalink / raw)
  To: filipe.silva; +Cc: help-gnu-emacs

 > I know that before deleting the frame, emacs runs the functions that are
 > listed in the variable delete-frame-functions,
 > so I thought I could include a function there that would prompt me to query
 > if I really wanted to kill the frame.
 > But it is not clear from the documentation what I would have to do inside
 > that function to stop the process of killing the frame.

‘delete-frame-functions’ cannot be used for preventing a frame from
getting deleted.  If it were able to do so, you would sooner or later
end up in some infinite recursion when trying to terminate a session.

 > Another idea would be to add an advice to evil-quit, like: if daemon-p is t
 > then evil-quit have to prompt me to quit my current frame.
 > Or Something like that?

Something like that, yes.

martin




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

end of thread, other threads:[~2017-02-05  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-05  2:34 how to make emacs prompt me before closing the last emacs gui frame when running emacs as a daemon? Filipe Silva
  -- strict thread matches above, loose matches on Subject: below --
2017-02-05  9:15 martin rudalics

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.