Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-exit-group-hook
@ 2017-12-18  3:29 Bob Newell
  2017-12-18 18:20 ` gnus-exit-group-hook Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Bob Newell @ 2017-12-18  3:29 UTC (permalink / raw)
  To: ding

Aloha

When exiting the summary buffer, gnus-exit-group-hook is run unless the
summary buffer is exited in a non-updating manner (such as with Q
instead of q).

But I note that the hook is called in gnus-sum.el as follows:

    (unless quit-config
      (gnus-run-hooks 'gnus-exit-group-hook)
      (gnus-summary-update-info))

Note that the hook is called before the summary info is updated. I was
relying on this hook to determine and save the number of still unread
articles in the group, but I don't get that, I get the number of unread
articles at the time of group entry, not exit.

Shouldn't the hook run after the update? Or am (quite typically) I
missing something here?


Mahalo,

-- 
Bob Newell
Honolulu, Hawai`i
* Via Gnus/BBDB/Org/Emacs/Linux *



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

* Re: gnus-exit-group-hook
  2017-12-18  3:29 gnus-exit-group-hook Bob Newell
@ 2017-12-18 18:20 ` Eric Abrahamsen
  2017-12-18 19:46   ` gnus-exit-group-hook Emanuel Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2017-12-18 18:20 UTC (permalink / raw)
  To: ding

Bob Newell <bobnewell@bobnewell.net> writes:

> Aloha
>
> When exiting the summary buffer, gnus-exit-group-hook is run unless the
> summary buffer is exited in a non-updating manner (such as with Q
> instead of q).
>
> But I note that the hook is called in gnus-sum.el as follows:
>
>     (unless quit-config
>       (gnus-run-hooks 'gnus-exit-group-hook)
>       (gnus-summary-update-info))
>
> Note that the hook is called before the summary info is updated. I was
> relying on this hook to determine and save the number of still unread
> articles in the group, but I don't get that, I get the number of unread
> articles at the time of group entry, not exit.
>
> Shouldn't the hook run after the update? Or am (quite typically) I
> missing something here?

I guess it's just a matter of what you might want to use the hook for.
Some people might want to use it to short-circuit the update process.

I'm surprised you can't get the number you want, though -- the local
variable `gnus-newsgroup-unreads' should be updated in real time as you
read articles. If all you want is to do something with the number of
unreads, can't you take the `length' of that?

Eric




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

* Re: gnus-exit-group-hook
  2017-12-18 18:20 ` gnus-exit-group-hook Eric Abrahamsen
@ 2017-12-18 19:46   ` Emanuel Berg
  2017-12-18 23:41     ` gnus-exit-group-hook Bob Newell
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2017-12-18 19:46 UTC (permalink / raw)
  To: ding

Eric Abrahamsen wrote:

> I guess it's just a matter of what you might
> want to use the hook for. Some people might
> want to use it to short-circuit the
> update process.

The "feelingly" inconsistent state with buffers
all over the place and changes that are done
but then reoccurs the next time you check was
a source of constant confusion/frustration in
my early Gnus days. Without understanding it,
really, I made a lot of in-between functions to
force it into what I suspect is a very
heavy-handed mold, but rather that then doing
things with the sensation maybe it isn't really
done, or maybe it is, and something else isn't,
and what have you.

Here is a Summary buffer example:

    (defun gnus-summary-exit-and-update-group ()
      (interactive)
      (kill-buffer)
      (gnus-summary-save-newsrc)
      (gnus-switch-to-group-buffer) ) ; [1]

Here is all my other Gnus [2]. If anyone wants
to wade thru it, in search of the odd nugget,
or likewise "hey, that isn't necessary",
feel free.

(prolonged silence)

OK, so no one wants to do that. Why not?!

[1] http://user.it.uu.se/~embe8573/emacs-init/gnus/summary.el
[2] http://user.it.uu.se/~embe8573/emacs-init/gnus/

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




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

* Re: gnus-exit-group-hook
  2017-12-18 19:46   ` gnus-exit-group-hook Emanuel Berg
@ 2017-12-18 23:41     ` Bob Newell
  2017-12-18 23:55       ` gnus-exit-group-hook Bob Newell
  0 siblings, 1 reply; 6+ messages in thread
From: Bob Newell @ 2017-12-18 23:41 UTC (permalink / raw)
  To: ding

Aloha and thanks for the replies.

Eric: gnus-newsgroup-unread is indeed the variable I test, and it
doesn't seem to update as articles are read, only when exiting the
group summary buffer. This "sort of" makes sense, because if you exit
with 'Q' you don't want that or anything else updated, perhaps? So
updates only happen when you "commit" them with a form of exit that
supports it--- such as 'q'.

In any case, rather than modify Gnus code directly and creating a
maintenance issue for myself, I dropped my hook call and instead added
:after advice to gnus-summary-update-info, and now my code runs after
all variables are updated.

Emmanuel: I definitely will look at your gnus coding. There is always
more to learn, and in the case of Gnus, always more to unlearn as
well.

Bob Newell
Honolulu



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

* Re: gnus-exit-group-hook
  2017-12-18 23:41     ` gnus-exit-group-hook Bob Newell
@ 2017-12-18 23:55       ` Bob Newell
  2017-12-19  1:40         ` gnus-exit-group-hook Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Bob Newell @ 2017-12-18 23:55 UTC (permalink / raw)
  To: ding

OOPS. I was calling the function gnus-group-unread, not checking the
variable gnus-newsgroup-unreads, which quite frankly I didn't know
about. Thanks for the tip on that, and you are right, that is updated
as you go.

Gnus is an experiment in lifelong learning.
Bob Newell
Honolulu



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

* Re: gnus-exit-group-hook
  2017-12-18 23:55       ` gnus-exit-group-hook Bob Newell
@ 2017-12-19  1:40         ` Eric Abrahamsen
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2017-12-19  1:40 UTC (permalink / raw)
  To: ding

Bob Newell <bobnewell@bobnewell.net> writes:

> OOPS. I was calling the function gnus-group-unread, not checking the
> variable gnus-newsgroup-unreads, which quite frankly I didn't know
> about. Thanks for the tip on that, and you are right, that is updated
> as you go.

Yeah, there's a whole pile of summary buffer-local variables that keep
track of everything you've done. When you exit they either get
"uploaded" to the actual backend, or discarded, depending on how you
exit.

Glad it's sorted!

Eric




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

end of thread, other threads:[~2017-12-19  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18  3:29 gnus-exit-group-hook Bob Newell
2017-12-18 18:20 ` gnus-exit-group-hook Eric Abrahamsen
2017-12-18 19:46   ` gnus-exit-group-hook Emanuel Berg
2017-12-18 23:41     ` gnus-exit-group-hook Bob Newell
2017-12-18 23:55       ` gnus-exit-group-hook Bob Newell
2017-12-19  1:40         ` gnus-exit-group-hook 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 NNTP newsgroup(s).