unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* remember all the little quits before you do the big quit :)
@ 2018-08-23 13:54 Hikaru Ichijyo
  2018-08-23 16:28 ` Andy Moreton
  2018-08-24 10:04 ` Eric Abrahamsen
  0 siblings, 2 replies; 6+ messages in thread
From: Hikaru Ichijyo @ 2018-08-23 13:54 UTC (permalink / raw)
  To: help-gnu-emacs

In the Gnus manual, it says:

--8<---------------cut here---------------start------------->8---
This message means that the last time you used Gnus, it wasn’t properly
exited and therefore couldn’t write its information to disk (e.g., which
messages you read), you are now asked if you want to restore that
information from the auto-save file.

To prevent this message make sure you exit Gnus via ‘q’ in group
buffer instead of just killing Emacs.
--8<---------------cut here---------------end--------------->8---

This is a good idea to avoid getting prompted about autosave files next
time you start Gnus.  Emacs-W3M and ERC have their own quit commands,
and seem also to prefer you didn't just quit your whole Emacs session
while they're still around.

Emacs checks to see if you have unsaved buffers at exit, and will prompt
you if there are running subordinate processes...but it's a little picky
about what it considers a "process," mostly meaning that in the sense of
processes in the underlying OS, not Lisp programs like Gnus or
Emacs-W3M.

It would be nice if Emacs would give options on shutdown to terminate
Lisp applications in the same fashion it checks for unsaved buffers and
subordinate Unix processes.  I know there are probably ways people have
hacked together solutions for this in their ~/.emacs files (and I'd love
to see them, if anybody wants to post snippets), but it just seems like
if Emacs is taking the effort to warn me of things I need to take care
of before shutdown, it shouldn't be forgetting about its own running
applications just because they're not OS processes.

-- 
He that would make his own liberty secure must guard even his enemy from
oppression; for if he violates this duty, he establishes a precedent
that will reach to himself.
					--Thomas Paine


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

* Re: remember all the little quits before you do the big quit :)
  2018-08-23 13:54 remember all the little quits before you do the big quit :) Hikaru Ichijyo
@ 2018-08-23 16:28 ` Andy Moreton
  2018-08-26 15:55   ` hw
       [not found]   ` <mailman.5574.1535316754.1292.help-gnu-emacs@gnu.org>
  2018-08-24 10:04 ` Eric Abrahamsen
  1 sibling, 2 replies; 6+ messages in thread
From: Andy Moreton @ 2018-08-23 16:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu 23 Aug 2018, Hikaru Ichijyo wrote:

> It would be nice if Emacs would give options on shutdown to terminate
> Lisp applications in the same fashion it checks for unsaved buffers and
> subordinate Unix processes.  I know there are probably ways people have
> hacked together solutions for this in their ~/.emacs files (and I'd love
> to see them, if anybody wants to post snippets), but it just seems like
> if Emacs is taking the effort to warn me of things I need to take care
> of before shutdown, it shouldn't be forgetting about its own running
> applications just because they're not OS processes.

I have this snippet in .gnus to do that:

  (defun ajm-kill-emacs-exit-gnus ()
    (when (gnus-alive-p)
      (with-current-buffer (get-buffer "*Group*")
        (let ((gnus-expert-user t)
              (gnus-interactive-exit 'quiet))
          (gnus-group-exit)))))
  (add-hook 'kill-emacs-hook #'ajm-kill-emacs-exit-gnus))


HTH,

    AndyM




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

* Re: remember all the little quits before you do the big quit :)
  2018-08-23 13:54 remember all the little quits before you do the big quit :) Hikaru Ichijyo
  2018-08-23 16:28 ` Andy Moreton
@ 2018-08-24 10:04 ` Eric Abrahamsen
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2018-08-24 10:04 UTC (permalink / raw)
  To: help-gnu-emacs

Hikaru Ichijyo <ichijyo@macross.sdf.jp> writes:

> In the Gnus manual, it says:
>
> This message means that the last time you used Gnus, it wasn’t properly
> exited and therefore couldn’t write its information to disk (e.g., which
> messages you read), you are now asked if you want to restore that
> information from the auto-save file.
>
> To prevent this message make sure you exit Gnus via ‘q’ in group
> buffer instead of just killing Emacs.
>
> This is a good idea to avoid getting prompted about autosave files next
> time you start Gnus.  Emacs-W3M and ERC have their own quit commands,
> and seem also to prefer you didn't just quit your whole Emacs session
> while they're still around.
>
> Emacs checks to see if you have unsaved buffers at exit, and will prompt
> you if there are running subordinate processes...but it's a little picky
> about what it considers a "process," mostly meaning that in the sense of
> processes in the underlying OS, not Lisp programs like Gnus or
> Emacs-W3M.
>
> It would be nice if Emacs would give options on shutdown to terminate
> Lisp applications in the same fashion it checks for unsaved buffers and
> subordinate Unix processes.  I know there are probably ways people have
> hacked together solutions for this in their ~/.emacs files (and I'd love
> to see them, if anybody wants to post snippets), but it just seems like
> if Emacs is taking the effort to warn me of things I need to take care
> of before shutdown, it shouldn't be forgetting about its own running
> applications just because they're not OS processes.

Not too long ago I put in a patch that allows non-file-visiting buffers
to advertise themselves as savable to `save-some-buffers'. If you set
the buffer-local variable `buffer-offer-save' to the symbol `always',
and add a function to `write-contents-functions' that handles the save,
it will happen as part of the `save-buffers-kill-emacs' process. That's
pretty recent, though.

Eric




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

* Re: remember all the little quits before you do the big quit :)
  2018-08-23 16:28 ` Andy Moreton
@ 2018-08-26 15:55   ` hw
       [not found]   ` <mailman.5574.1535316754.1292.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: hw @ 2018-08-26 15:55 UTC (permalink / raw)
  To: help-gnu-emacs

Andy Moreton <andrewjmoreton@gmail.com> writes:

> On Thu 23 Aug 2018, Hikaru Ichijyo wrote:
>
>> It would be nice if Emacs would give options on shutdown to terminate
>> Lisp applications in the same fashion it checks for unsaved buffers and
>> subordinate Unix processes.  I know there are probably ways people have
>> hacked together solutions for this in their ~/.emacs files (and I'd love
>> to see them, if anybody wants to post snippets), but it just seems like
>> if Emacs is taking the effort to warn me of things I need to take care
>> of before shutdown, it shouldn't be forgetting about its own running
>> applications just because they're not OS processes.
>
> I have this snippet in .gnus to do that:
>
>   (defun ajm-kill-emacs-exit-gnus ()
>     (when (gnus-alive-p)
>       (with-current-buffer (get-buffer "*Group*")
>         (let ((gnus-expert-user t)
>               (gnus-interactive-exit 'quiet))
>           (gnus-group-exit)))))
>   (add-hook 'kill-emacs-hook #'ajm-kill-emacs-exit-gnus))

Awesome!  What is the minimum Emacs version for this to work?  I asked
for something like this a couple years ago and was told it's impossible.



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

* Re: remember all the little quits before you do the big quit :)
       [not found]   ` <mailman.5574.1535316754.1292.help-gnu-emacs@gnu.org>
@ 2018-08-26 21:08     ` Emanuel Berg
  2018-08-27 15:27       ` hw
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2018-08-26 21:08 UTC (permalink / raw)
  To: help-gnu-emacs

hw wrote:

> Awesome! What is the minimum Emacs version
> for this to work? I asked for something like
> this a couple years ago and was told
> it's impossible.

Here is some other stuff for you to experiment
with if need be. The `require' below is to get
this, I think

(defun gnus-kill-if-runs ()
  (when (gnus-alive-p) (gnus-group-exit)) )

so here goes

;; This file: http://user.it.uu.se/~embe8573/emacs-init/quit.el

(require 'gnus-my)

(defun mute-kill-warnings ()
  (dolist (p (process-list))
    (set-process-query-on-exit-flag p nil) ))

(defun kill-everything ()
  (gnus-kill-if-runs)
  (mute-kill-warnings) )

(defun shutdown ()
  (interactive)
  (kill-everything)
  (shell-command "shut") )
(defalias 'shut 'shutdown)

(defun emacs-quit-no-confirm ()
  (interactive)
  (kill-everything)
  (save-buffers-kill-terminal t) ) ; silently save ... kill
(defalias 'quit       'emacs-quit-no-confirm)
(defalias 'quit-emacs 'emacs-quit-no-confirm)
(defalias 'emacs-quit 'emacs-quit-no-confirm)

;; (setq kill-emacs-hook nil)
(defun kill-emacs-hook-f ()
  (kill-everything) )
(add-hook 'kill-emacs-hook #'kill-emacs-hook-f)

(provide 'quit)

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* Re: remember all the little quits before you do the big quit :)
  2018-08-26 21:08     ` Emanuel Berg
@ 2018-08-27 15:27       ` hw
  0 siblings, 0 replies; 6+ messages in thread
From: hw @ 2018-08-27 15:27 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <moasen@zoho.com> writes:

> hw wrote:
>
>> Awesome! What is the minimum Emacs version
>> for this to work? I asked for something like
>> this a couple years ago and was told
>> it's impossible.
>
> Here is some other stuff for you to experiment
> with if need be. The `require' below is to get
> this, I think

Thanks, I'll try it out :)


> [...]



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

end of thread, other threads:[~2018-08-27 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23 13:54 remember all the little quits before you do the big quit :) Hikaru Ichijyo
2018-08-23 16:28 ` Andy Moreton
2018-08-26 15:55   ` hw
     [not found]   ` <mailman.5574.1535316754.1292.help-gnu-emacs@gnu.org>
2018-08-26 21:08     ` Emanuel Berg
2018-08-27 15:27       ` hw
2018-08-24 10:04 ` Eric Abrahamsen

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