1

I'm wondering why this hook never works:

(add-hook 'gnus-group-prepared-hook 'gnus-group-list-all-groups)

Description of the hook:

is called as the very last thing after the group buffer has been generated. It may be used to move point around, for instance.

I've also tried gnus-group-mode-hook (specified function is called, but no effect) and gnus-group-prepare-hook (never called).

Expected behavior: when I start Gnus via M-x gnus, it should list all groups immediately.

  • The tag you're looking for is called hooks, and it already exists :) – itsjeyd Nov 13 '14 at 20:10
  • 3
    I don't get the same behavior on my Emacs when I try this. (For one, you have a typo with gnus-group-prepared-hook. More significantly, my Gnus does list all groups, but only after erroring due to max recursion depth.) Please post a minimum working example for me to debug the problem ... I should be able to start emacs with emacs -Q, eval your code in the *scratch* buffer, and see what you're talking about. – purple_arrows Nov 13 '14 at 21:12
  • @purple_arrows, sorry I don't see any typo in gnus-group-prepared-hook. – Mark Karpov Nov 14 '14 at 8:05
  • @purple_arrows, Minimal complete example is not easy to write, aside from contents of .emacs that you can evaluate in *scratch*, it should include .gnus file and .authinfo. – Mark Karpov Nov 14 '14 at 8:47
1

I'm still unable to make gnus-group-prepared-hook work. Empty groups are not displayed on start of Gnus and I don't get any error messages.

However, I have succeeded in my initial intention to display all groups automatically. In order to achieve this behavior, one should set value of variable gnus-permanently-visible-groups.

Description of this variable:

Groups matching this regexp will always be listed in the group buffer, whether they are empty or not.

So, if you want to display all groups on start of Gnus, add this line to your .emacs:

(setq gnus-permanently-visible-groups "")
0

Your answer is in the question.

is called as the very last thing after the group buffer has been generated.

Meanwhile, gnus-group-list-all-groups essentially regenerates the group buffer. This means that the hook will be called again when gnus-group-list-all-groups is about to finish. But gnus-group-list-all-groups is contained in the hook, so it will run again and again and again...

Eventually, Emacs throws a max-lisp-depth error (which you should find somewhere in your Messages buffer) and the function quits.

  • It's the case with gnus-group-prepare-hook. However, gnus-group-prepared-hook is never called at all, even if I write (add-hook 'gnus-group-prepared-hook (lambda () (message "hi!"))), it doesn't work. P.S. gnus-group-prepared-hook exists, it's not a typo. Click the link to read about difference between prepare and prepared hook. My question was about the second one. – Mark Karpov Nov 14 '14 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.