Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: "Adam Sjøgren" <asjo@koldfront.dk>
To: info-gnus-english@gnu.org
Subject: Re: Update topic unread counts on group exit?
Date: Wed, 04 May 2022 20:17:02 +0200	[thread overview]
Message-ID: <87h7655fj5.fsf@tullinup.koldfront.dk> (raw)
In-Reply-To: <874k25qiwi.fsf@ericabrahamsen.net>

Eric writes:

>> Is there a way to get Gnus to update the counts automatically on group
>> exit as well?

> It looks to me like you could add a function to
> `gnus-summary-exit-hook', which calls
> `gnus-topic-update-topics-containing-group' on the value of
> `gnus-newsgroup-name'. At that stage in summary exit,
> `gnus-newsgroup-name' won't have been cleared yet, so it should still
> hold the name of the group you're coming out of.

Any reason for Gnus not to do that by default?

I hacked this together before reading your suggestion:

    (defun asjo-update-topics ()
      (let ((pos (point)))
        (beginning-of-buffer)
        (gnus-topic-read-group)
        (gnus-topic-read-group)
        (goto-char pos)))

    (add-hook 'gnus-summary-exit-hook 'asjo-update-topics)

Which just toggles the top-level topic, which has the side effect of
updating the counts.

I couldn't make save-mark-and-excursion work, so I did the point +
goto-char dance, which is a little icky.

I will see if I can get your suggestion going after dinner :-)

Thanks!


  Best regards,

    Adam

-- 
 "Our voodoo-dolls are full of hopes"                       Adam Sjøgren
                                                       asjo@koldfront.dk



  reply	other threads:[~2022-05-04 18:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 17:35 Adam Sjøgren
2022-05-04 17:58 ` Eric Abrahamsen
2022-05-04 18:17   ` Adam Sjøgren [this message]
2022-05-04 18:23     ` Adam Sjøgren
2022-05-04 19:51       ` Eric Abrahamsen
2022-05-04 21:16         ` Adam Sjøgren
2022-05-04 21:44         ` Adam Sjøgren
2022-05-05  1:00           ` Eric Abrahamsen
2022-05-05  4:36             ` Adam Sjøgren
2022-05-04 18:32     ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7655fj5.fsf@tullinup.koldfront.dk \
    --to=asjo@koldfront.dk \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).