unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Graceful Gnus exit on Emacs exit
@ 2020-04-21 18:47 Sergey Organov
  2020-04-21 18:55 ` Eric Abrahamsen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sergey Organov @ 2020-04-21 18:47 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

Gnus v5.31 doesn't seem to install any hooks at Emacs exit that is unfortunate.

After some digging I came up with the following code in my .gnus.el to
gracefully exit Gnus on Emacs exit:

(defun gnus-exit ()
  "Exit gnus without confirmation and return 't"
  (let ((noninteractive 't)
        (gnus-expert-user 't)
        (gnus-interactive-exit 'quiet))
    (gnus-group-exit) 't))

(add-hook 'kill-emacs-hook 'gnus-exit)

I worry why it ended up being that complex? Is there better way?

Thanks,
-- Sergey



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-21 18:47 Graceful Gnus exit on Emacs exit Sergey Organov
@ 2020-04-21 18:55 ` Eric Abrahamsen
  2020-04-21 20:48   ` Sergey Organov
  2020-04-22  5:13 ` Colin Baxter
  2020-04-22 17:38 ` Bob Newell
  2 siblings, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2020-04-21 18:55 UTC (permalink / raw)
  To: Sergey Organov; +Cc: help-gnu-emacs

Sergey Organov <sorganov@gmail.com> writes:

> Hello,
>
> Gnus v5.31 doesn't seem to install any hooks at Emacs exit that is unfortunate.
>
> After some digging I came up with the following code in my .gnus.el to
> gracefully exit Gnus on Emacs exit:
>
> (defun gnus-exit ()
>   "Exit gnus without confirmation and return 't"
>   (let ((noninteractive 't)
>         (gnus-expert-user 't)
>         (gnus-interactive-exit 'quiet))
>     (gnus-group-exit) 't))
>
> (add-hook 'kill-emacs-hook 'gnus-exit)
>
> I worry why it ended up being that complex? Is there better way?

I wouldn't actually consider that to be very complex! At least not
compared to the elisp customizations I end up writing :)

The non-complex version would be:

(add-hook 'hill-emacs-hook #'gnus-group-exit)

Though you'd have to deal with the prompts.

No, I don't think there's a better way.







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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-21 18:55 ` Eric Abrahamsen
@ 2020-04-21 20:48   ` Sergey Organov
  0 siblings, 0 replies; 9+ messages in thread
From: Sergey Organov @ 2020-04-21 20:48 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Sergey Organov <sorganov@gmail.com> writes:
>
>> Hello,
>>
>> Gnus v5.31 doesn't seem to install any hooks at Emacs exit that is unfortunate.
>>
>> After some digging I came up with the following code in my .gnus.el to
>> gracefully exit Gnus on Emacs exit:
>>
>> (defun gnus-exit ()
>>   "Exit gnus without confirmation and return 't"
>>   (let ((noninteractive 't)
>>         (gnus-expert-user 't)
>>         (gnus-interactive-exit 'quiet))
>>     (gnus-group-exit) 't))
>>
>> (add-hook 'kill-emacs-hook 'gnus-exit)
>>
>> I worry why it ended up being that complex? Is there better way?
>
> I wouldn't actually consider that to be very complex! At least not
> compared to the elisp customizations I end up writing :)

I just hoped for a "Graceful shutdown on Emacs exit" somewhere
among million Gnus knobs.

>
> The non-complex version would be:
>
> (add-hook 'hill-emacs-hook #'gnus-group-exit)

Yeah, that's what I thought as well.

>
> Though you'd have to deal with the prompts.

... and that's where the actual journey started!

>
> No, I don't think there's a better way.

Sigh... Thanks!

-- Sergey



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-21 18:47 Graceful Gnus exit on Emacs exit Sergey Organov
  2020-04-21 18:55 ` Eric Abrahamsen
@ 2020-04-22  5:13 ` Colin Baxter
  2020-04-22  7:52   ` Sergey Organov
  2020-04-22 17:38 ` Bob Newell
  2 siblings, 1 reply; 9+ messages in thread
From: Colin Baxter @ 2020-04-22  5:13 UTC (permalink / raw)
  To: Sergey Organov; +Cc: help-gnu-emacs

>>>>> Sergey Organov <sorganov@gmail.com> writes:

    > Hello, Gnus v5.31 doesn't seem to install any hooks at Emacs exit
    > that is unfortunate.

version 5.13 surely, or have I been asleep?



-- 
Colin Baxter
URL: http://www.Colin-Baxter.com
---------------------------------------------------------------------
GnuPG fingerprint: 68A8 799C 0230 16E7 BF68  2A27 BBFA 2492 91F5 41C8
---------------------------------------------------------------------



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-22  5:13 ` Colin Baxter
@ 2020-04-22  7:52   ` Sergey Organov
  2020-04-22 11:13     ` Colin Baxter
  0 siblings, 1 reply; 9+ messages in thread
From: Sergey Organov @ 2020-04-22  7:52 UTC (permalink / raw)
  To: Colin Baxter; +Cc: help-gnu-emacs

Colin Baxter <m43cap@yandex.com> writes:

>>>>>> Sergey Organov <sorganov@gmail.com> writes:
>
>     > Hello, Gnus v5.31 doesn't seem to install any hooks at Emacs exit
>     > that is unfortunate.
>
> version 5.13 surely, or have I been asleep?

Yeah, sure, it rather was me who was mistyping, sorry!

-- Sergey



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-22  7:52   ` Sergey Organov
@ 2020-04-22 11:13     ` Colin Baxter
  0 siblings, 0 replies; 9+ messages in thread
From: Colin Baxter @ 2020-04-22 11:13 UTC (permalink / raw)
  To: Sergey Organov; +Cc: help-gnu-emacs

Dear Sergey

You had me worried for a moment!
>>>>> Sergey Organov <sorganov@gmail.com> writes:

    > Colin Baxter <m43cap@yandex.com> writes:
    >>>>>>> Sergey Organov <sorganov@gmail.com> writes:
    >> 
    >> > Hello, Gnus v5.31 doesn't seem to install any hooks at Emacs
    >> exit > that is unfortunate.
    >> 
    >> version 5.13 surely, or have I been asleep?

    > Yeah, sure, it rather was me who was mistyping, sorry!

    > -- Sergey

Best wishes,

-- 
Colin Baxter
URL: http://www.Colin-Baxter.com
---------------------------------------------------------------------
GnuPG fingerprint: 68A8 799C 0230 16E7 BF68  2A27 BBFA 2492 91F5 41C8
---------------------------------------------------------------------
The sole cause of all human misery is the inability of people to sit
quietly in their rooms.  Blaise Pascal, 1670
---------------------------------------------------------------------



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-21 18:47 Graceful Gnus exit on Emacs exit Sergey Organov
  2020-04-21 18:55 ` Eric Abrahamsen
  2020-04-22  5:13 ` Colin Baxter
@ 2020-04-22 17:38 ` Bob Newell
  2020-04-22 18:06   ` Eric Abrahamsen
  2020-04-22 22:12   ` Sergey Organov
  2 siblings, 2 replies; 9+ messages in thread
From: Bob Newell @ 2020-04-22 17:38 UTC (permalink / raw)
  To: Sergey Organov; +Cc: help-gnu-emacs

> (defun gnus-exit ()
>   "Exit gnus without confirmation and return 't"
>   (let ((noninteractive 't)
>         (gnus-expert-user 't)
>         (gnus-interactive-exit 'quiet))
>     (gnus-group-exit) 't))
>
> (add-hook 'kill-emacs-hook 'gnus-exit)

If it's any consolation, I do what amounts to the exact same thing,
including avoiding the prompts. I've noticed one undesirable side
effect (and very likely it's just the rest of my setup causing it) ...
if I should happen to exit Gnus during my Emacs session, when I
terminate Emacs, Gnus starts up again just so it can shut down !

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU/Linux/Emacs/Gnus/BBDB.



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-22 17:38 ` Bob Newell
@ 2020-04-22 18:06   ` Eric Abrahamsen
  2020-04-22 22:12   ` Sergey Organov
  1 sibling, 0 replies; 9+ messages in thread
From: Eric Abrahamsen @ 2020-04-22 18:06 UTC (permalink / raw)
  To: Bob Newell; +Cc: help-gnu-emacs, Sergey Organov

Bob Newell <bobnewell@bobnewell.net> writes:

>> (defun gnus-exit ()
>>   "Exit gnus without confirmation and return 't"
>>   (let ((noninteractive 't)
>>         (gnus-expert-user 't)
>>         (gnus-interactive-exit 'quiet))
>>     (gnus-group-exit) 't))
>>
>> (add-hook 'kill-emacs-hook 'gnus-exit)
>
> If it's any consolation, I do what amounts to the exact same thing,
> including avoiding the prompts. I've noticed one undesirable side
> effect (and very likely it's just the rest of my setup causing it) ...
> if I should happen to exit Gnus during my Emacs session, when I
> terminate Emacs, Gnus starts up again just so it can shut down !

Ha! You could wrap it in a check to `gnus-alive-p' to avoid that...



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

* Re: Graceful Gnus exit on Emacs exit
  2020-04-22 17:38 ` Bob Newell
  2020-04-22 18:06   ` Eric Abrahamsen
@ 2020-04-22 22:12   ` Sergey Organov
  1 sibling, 0 replies; 9+ messages in thread
From: Sergey Organov @ 2020-04-22 22:12 UTC (permalink / raw)
  To: Bob Newell; +Cc: help-gnu-emacs

Bob Newell <bobnewell@bobnewell.net> writes:

>> (defun gnus-exit ()
>>   "Exit gnus without confirmation and return 't"
>>   (let ((noninteractive 't)
>>         (gnus-expert-user 't)
>>         (gnus-interactive-exit 'quiet))
>>     (gnus-group-exit) 't))
>>
>> (add-hook 'kill-emacs-hook 'gnus-exit)
>
> If it's any consolation, I do what amounts to the exact same thing,
> including avoiding the prompts.

It sure is, thanks for sharing!

> I've noticed one undesirable side effect (and very likely it's just
> the rest of my setup causing it) ... if I should happen to exit Gnus
> during my Emacs session, when I terminate Emacs, Gnus starts up again
> just so it can shut down !

Tried it here, but didn't notice Gnus start, so it's likely something in
your setup indeed, as I do need to wait a little when Gnus actually
starts.

-- Sergey



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

end of thread, other threads:[~2020-04-22 22:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-21 18:47 Graceful Gnus exit on Emacs exit Sergey Organov
2020-04-21 18:55 ` Eric Abrahamsen
2020-04-21 20:48   ` Sergey Organov
2020-04-22  5:13 ` Colin Baxter
2020-04-22  7:52   ` Sergey Organov
2020-04-22 11:13     ` Colin Baxter
2020-04-22 17:38 ` Bob Newell
2020-04-22 18:06   ` Eric Abrahamsen
2020-04-22 22:12   ` Sergey Organov

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