Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hooking after getting new news

0 views
Skip to first unread message

Nevin Kapur

unread,
Aug 31, 2001, 6:06:57 PM8/31/01
to
Ami Fischman <use...@fischman.org> writes:

> After fetching new news I'd like Gnus to move the cursor to the first group
> containing unread messages.

I use

(add-hook 'gnus-after-getting-new-news-hook 'gnus-group-first-unread-group)

which seems to do what you want.

--
Nevin

Kai Großjohann

unread,
Aug 31, 2001, 6:48:09 PM8/31/01
to
Ami Fischman <use...@fischman.org> writes:

> After fetching new news I'd like Gnus to move the cursor to the first group
> containing unread messages.

Given that fetching news takes quite a bit of time, you might just
type `g,' instead of `g'. Or maybe `g.' rather than `g,'. That's
what I do, at least.

kai
--
Symbol's function definition is void: signature

Nevin Kapur

unread,
Sep 1, 2001, 12:33:58 AM9/1/01
to
Ami Fischman <use...@fischman.org> writes:

> Nevin Kapur <ne...@jhu.edu> writes:
> > I use
>> (add-hook 'gnus-after-getting-new-news-hook 'gnus-group-first-unread-group)
>> which seems to do what you want.
>

> Really? For me it still doesn't work right. Suppose I have a bunch of mail
> groups with ticked articles in them, and no unread articles in them
> (i.e. "starred" groups). I then recieve a new mail, and hit 'g'. The mail
> gets split to the right group, which gets highlighted (since it has unread
> articles), but the cursor doesn't move anywhere. however, if I type 'g'
> again (and this time there is NO new email), then since that group was
> already containing a new message in the group buffer, the cursor moves to
> it. Do you get the cursor moving on the first 'g'?

The cursor moves to the first unread group each time I press 'g'. (Or
'1 g' or '2 g'.) What happens if you manually execute
gnus-group-first-unread-group (bound to '.') after the first 'g'?

> Which version of
> Gnus/Emacs do you use? 5.8.8 and FSFEmacs 20.7.1, here.

(emacs-version)
"XEmacs 21.4 (patch 4) \"Artificial Intelligence\" [Lucid] (i686-pc-linux) of Sat Aug 18 2001 on fermat.mts.jhu.edu"
(gnus-version)
"Oort Gnus v0.04"

This is a fairly recent Oort.


--
Nevin

Kai Großjohann

unread,
Sep 1, 2001, 12:43:07 PM9/1/01
to
Ami Fischman <use...@fischman.org> writes:

> Thanks for the '.' suggestion -- didn't realize that was already bound.
> Fetching news is very quick for me (I've been blessed with fast and local
> NNTP access :), though I don't see the relevance of speed for this. I'm
> already wanting to fetch new news, I just want to modify the post-fetching
> behaviour (and accomplish it in one keystroke :)).

(defun ami ()
(interactive)
(gnus-group-get-new-news)
(gnus-group-first-unread-group))

Then bind it to a key. Does that work?

Of course, your idea with gnus-after-getting-new-news-hook _should_
have worked.

Kai Großjohann

unread,
Sep 3, 2001, 12:44:07 PM9/3/01
to
Ami Fischman <use...@fischman.org> writes:

> It works as long as I can teach myself to hit something other than 'g'...:)
> my real problem is the Gnus startup overwrites the "g" binding when starting
> up, so even if I bind my own function to it, the binding gets killed when I
> start up gnus... This is what sent me running after the hooks in the first
> place...

Maybe gnus-group-mode-hook is a good place to do the binding? Or are
you saying that Gnus resets the binding even _after_
gnus-group-mode-hook?

those who know me have no need of my name

unread,
Sep 5, 2001, 4:37:24 AM9/5/01
to
<81wv3jr...@zion.bpnetworks.com> divulged:
>Nevin Kapur <ne...@jhu.edu> writes:

>> I use
>> (add-hook 'gnus-after-getting-new-news-hook 'gnus-group-first-unread-group)
>> which seems to do what you want.
>

>Really? For me it still doesn't work right.

perhaps gnus-group-prepare-hook instead.

Kai Großjohann

unread,
Sep 5, 2001, 2:26:16 PM9/5/01
to
Ami Fischman <use...@fischman.org> writes:

> What versions does this hook show up in? It doesn't seem to exist in
> 5.8.8...

Even if C-h v doesn't show you the variable, the hook might be run
anyway. Search the complete Gnus source code for occurrences of the
hook name.

Kai Großjohann

unread,
Sep 6, 2001, 6:13:26 PM9/6/01
to
Ami Fischman <use...@fischman.org> writes:

> In fact, the hook DOES exist in 5.8.8, and it gets run (I can put in a dummy
> function call to output a message and that works when I
> gnus-group-get-new-news), but the cursor still doesn't go anywhere in the
> group buffer (just stays where it was before the function call).

I've now looked at the source code for gnus-group-get-new-news. It
does stuff and then calls hooks, but after the last hook it calls
gnus-group-list-groups. And that function moves point.

The last thing that gnus-group-list-groups does is to call
gnus-group-position-point. You could redefine that function to move
point to where you want to go, but since the function might be called
way too often, point might move to that spot too often.

Hm. OTOH, you could write a function which checks the value of
this-command. If it's gnus-group-get-new-news, then move to the group
you want. If it's something else, call gnus-goto-colon.
(gnus-goto-colon is what gnus-group-position-point normally does.)

Sounds quite complicated.

Another idea would be

(defadvice gnus-group-get-new-news (after first-group last activate)
"Goto first group after getting new news."
(gnus-group-first-unread-group))

I have no idea whether it works. I don't grok defadvice. But you get
the idea, I think.

0 new messages