The code:
(defun gnus-topic-hide-all ()
(interactive)
(gnus-topic-show-all)
(gnus-topic-hide-list (gnus-topic-list)))
(defun gnus-topic-hide-list (this-list)
(interactive)
(dolist (this-topic this-list)
(when (gnus-topic-goto-topic this-topic)
(gnus-topic-hide-topic))))
(defun gnus-topic-show-all ()
(interactive)
(gnus-topic-show-list (gnus-topic-list)))
(defun gnus-topic-show-compact ()
(interactive)
(gnus-topic-hide-all)
(gnus-topic-show-list (list "Bedrijf" "Emacs" "NLLGG" "Privé")))
(defun gnus-topic-show-important ()
(interactive)
(gnus-topic-show-compact)
(gnus-topic-show-list (list "Algemeen" "InfoB" "Language" "Linux"
"Tex" "Web" "InfoP" "Misc")))
(defun gnus-topic-show-list (this-list)
(dolist (this-topic this-list)
(gnus-topic-jump-to-topic this-topic)
(gnus-topic-show-topic)))
and the key bindings:
(define-key gnus-group-mode-map (kbd "v t a")
'gnus-topic-show-all)
(define-key gnus-group-mode-map (kbd "v t c")
'gnus-topic-show-compact)
(define-key gnus-group-mode-map (kbd "v t i")
'gnus-topic-show-important)
(define-key gnus-group-mode-map (kbd "v t n")
'gnus-topic-hide-all)
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
CW> Most of the time I am not interested in all the groups. So I wrote a few
CW> functions and key bindings to easily switch between different situation.
CW> I hope it is useful to somebody. Of course the list with topics have to
CW> be changed to fit your situation. It does not work completely correct,
CW> but good enough to share.
CW> The key bindings are 'v t ?', with:
CW> a: show all topics
CW> c: show compact topics
CW> i: show important topics (compact and a few extra)
CW> n: show no topics
...
CW> (defun gnus-topic-show-compact ()
CW> (interactive)
CW> (gnus-topic-hide-all)
CW> (gnus-topic-show-list (list "Bedrijf" "Emacs" "NLLGG" "Priv�")))
CW> (defun gnus-topic-show-important ()
CW> (interactive)
CW> (gnus-topic-show-compact)
CW> (gnus-topic-show-list (list "Algemeen" "InfoB" "Language" "Linux"
CW> "Tex" "Web" "InfoP" "Misc")))
This is nice and useful. You could make it a Gnus add-on (living under
contrib/) if you make the compact and important topic lists
customizable.
Ted
> This is nice and useful. You could make it a Gnus add-on (living under
> contrib/) if you make the compact and important topic lists
> customizable.
Did not even think about that, but maybe that is not a bad idea. Maybe
it should be made even more general. I think it would be useful to have
more as a compact and a important list. And it would be nice if you do
not have to edit your .gnus for this. But then the topics have to be
saved somewhere. What is the best way to do this?
It would be nice to have contributed to Gnus. :-D
> This is nice and useful. You could make it a Gnus add-on (living under
> contrib/) if you make the compact and important topic lists
> customizable.
I think that I have come a long way to make it suitable. But I want to
go one step further. ;-)
At the moment I have several key bindings like the following:
(define-key gnus-group-mode-map (kbd "v j d")
(lambda ()
(interactive)
(gnus-group-jump-to-group "nndraft:drafts")))
The 'v' is reserved for Gnus, the 'j' is jump and -in this case- the 'd'
says to what needs to be jumped. What I would like to do, is to define a
list with entries like:
("d" "nndraft:drafts")
Then write something like:
(setq this-key-binding (concat "vj" (first this-jump)))
(define-key gnus-group-mode-map this-key-binding
(lambda ()
(interactive)
(gnus-group-jump-to-group (second this-jump))))
This seems to work, but there is one problem (I think). When this is
evaluated this gives:
(lambda nil (interactive) (gnus-group-jump-to-group (second this-jump)))
while I would expect:
(lambda nil (interactive) (gnus-group-jump-to-group "nndraft:drafts"))
What am I doing wrong?
CW> Ted Zlatanov <t...@lifelogs.com> writes:
>> This is nice and useful. You could make it a Gnus add-on (living under
>> contrib/) if you make the compact and important topic lists
>> customizable.
CW> Did not even think about that, but maybe that is not a bad idea. Maybe
CW> it should be made even more general. I think it would be useful to have
CW> more as a compact and a important list. And it would be nice if you do
CW> not have to edit your .gnus for this. But then the topics have to be
CW> saved somewhere. What is the best way to do this?
The topics are already saved in the Gnus newsrc.eld file. You just need
to associate a numeric level with a topic, which Gnus can do as a topic
property and save it automatically (see gnus-topic-edit-parameters,
`G p' in the *Group* buffer). Simply, gnus-group-set-current-level (`S l')
needs to be adapted to handle topics as well.
Once that's done, your commands can become filters on the full topic
list based on each topic's level.
CW> It would be nice to have contributed to Gnus. :-D
I hope you do!
Ted
> CW> Did not even think about that, but maybe that is not a bad idea. Maybe
> CW> it should be made even more general. I think it would be useful to have
> CW> more as a compact and a important list. And it would be nice if you do
> CW> not have to edit your .gnus for this. But then the topics have to be
> CW> saved somewhere. What is the best way to do this?
>
> The topics are already saved in the Gnus newsrc.eld file. You just need
> to associate a numeric level with a topic, which Gnus can do as a topic
> property and save it automatically (see gnus-topic-edit-parameters,
> `G p' in the *Group* buffer). Simply, gnus-group-set-current-level (`S l')
> needs to be adapted to handle topics as well.
>
> Once that's done, your commands can become filters on the full topic
> list based on each topic's level.
Not quite, I want to work with names. For two reasons: it is clearer and
I can think of a situation in which topic A should be visible in
situation I and topic B not and topic B should be visible in situation
II and topic A not. This can not be solved in your case, but it can in
mine.
> CW> It would be nice to have contributed to Gnus. :-D
>
> I hope you do!
The original case I already have implemented. I am still busy with some
icing on the cake.
CW> Ted Zlatanov <t...@lifelogs.com> writes:
CW> Did not even think about that, but maybe that is not a bad idea. Maybe
CW> it should be made even more general. I think it would be useful to have
CW> more as a compact and a important list. And it would be nice if you do
CW> not have to edit your .gnus for this. But then the topics have to be
CW> saved somewhere. What is the best way to do this?
>>
>> The topics are already saved in the Gnus newsrc.eld file. You just need
>> to associate a numeric level with a topic, which Gnus can do as a topic
>> property and save it automatically (see gnus-topic-edit-parameters,
>> `G p' in the *Group* buffer). Simply, gnus-group-set-current-level (`S l')
>> needs to be adapted to handle topics as well.
>>
>> Once that's done, your commands can become filters on the full topic
>> list based on each topic's level.
CW> Not quite, I want to work with names. For two reasons: it is clearer and
CW> I can think of a situation in which topic A should be visible in
CW> situation I and topic B not and topic B should be visible in situation
CW> II and topic A not. This can not be solved in your case, but it can in
CW> mine.
You can make the topic subscription level a list of strings
(effectively, tags). I encourage you to work with topic parameters
because configuring and storing them is already done by Gnus. With the
external approach you'll be doing more work and it won't integrate with
Gnus as well.
Ted
> This is nice and useful. You could make it a Gnus add-on (living under
> contrib/) if you make the compact and important topic lists
> customizable.
I think I made something that could be used. I have posted it on:
http://www.decebal.nl/EmacsLisp/sources/gnus/gnus-toggle-topics
Feedback is welcome.
What do I need to do to make it an add-on?