Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Some useful key bindings
@ 2009-12-23 12:06 Cecil Westerhof
  2010-01-05 19:14 ` Ted Zlatanov
  0 siblings, 1 reply; 8+ messages in thread
From: Cecil Westerhof @ 2009-12-23 12:06 UTC (permalink / raw)
  To: info-gnus-english

Most of the time I am not interested in all the groups. So I wrote a few
functions and key bindings to easily switch between different situation.
I hope it is useful to somebody. Of course the list with topics have to
be changed to fit your situation. It does not work completely correct,
but good enough to share.
The key bindings are 'v t ?', with:
  a: show all topics
  c: show compact topics
  i: show important topics (compact and a few extra)
  n: show no topics

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

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

* Re: Some useful key bindings
  2009-12-23 12:06 Some useful key bindings Cecil Westerhof
@ 2010-01-05 19:14 ` Ted Zlatanov
  2010-01-05 20:52   ` Cecil Westerhof
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ted Zlatanov @ 2010-01-05 19:14 UTC (permalink / raw)
  To: info-gnus-english

On Wed, 23 Dec 2009 13:06:29 +0100 Cecil Westerhof <Cecil@decebal.nl> wrote: 

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

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

* Re: Some useful key bindings
  2010-01-05 19:14 ` Ted Zlatanov
@ 2010-01-05 20:52   ` Cecil Westerhof
  2010-01-06 15:31     ` Ted Zlatanov
  2010-01-06  1:45   ` Cecil Westerhof
  2010-01-07 14:05   ` Cecil Westerhof
  2 siblings, 1 reply; 8+ messages in thread
From: Cecil Westerhof @ 2010-01-05 20:52 UTC (permalink / raw)
  To: info-gnus-english

Ted Zlatanov <tzz@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.

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

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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

* Re: Some useful key bindings
  2010-01-05 19:14 ` Ted Zlatanov
  2010-01-05 20:52   ` Cecil Westerhof
@ 2010-01-06  1:45   ` Cecil Westerhof
  2010-01-07 14:05   ` Cecil Westerhof
  2 siblings, 0 replies; 8+ messages in thread
From: Cecil Westerhof @ 2010-01-06  1:45 UTC (permalink / raw)
  To: info-gnus-english

Ted Zlatanov <tzz@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.

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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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

* Re: Some useful key bindings
  2010-01-05 20:52   ` Cecil Westerhof
@ 2010-01-06 15:31     ` Ted Zlatanov
  2010-01-06 15:53       ` Cecil Westerhof
  0 siblings, 1 reply; 8+ messages in thread
From: Ted Zlatanov @ 2010-01-06 15:31 UTC (permalink / raw)
  To: info-gnus-english

On Tue, 05 Jan 2010 21:52:28 +0100 Cecil Westerhof <Cecil@decebal.nl> wrote: 

CW> Ted Zlatanov <tzz@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

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

* Re: Some useful key bindings
  2010-01-06 15:31     ` Ted Zlatanov
@ 2010-01-06 15:53       ` Cecil Westerhof
  2010-01-06 21:43         ` Ted Zlatanov
  0 siblings, 1 reply; 8+ messages in thread
From: Cecil Westerhof @ 2010-01-06 15:53 UTC (permalink / raw)
  To: info-gnus-english

Ted Zlatanov <tzz@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.

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.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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

* Re: Some useful key bindings
  2010-01-06 15:53       ` Cecil Westerhof
@ 2010-01-06 21:43         ` Ted Zlatanov
  0 siblings, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2010-01-06 21:43 UTC (permalink / raw)
  To: info-gnus-english

On Wed, 06 Jan 2010 16:53:20 +0100 Cecil Westerhof <Cecil@decebal.nl> wrote: 

CW> Ted Zlatanov <tzz@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

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

* Re: Some useful key bindings
  2010-01-05 19:14 ` Ted Zlatanov
  2010-01-05 20:52   ` Cecil Westerhof
  2010-01-06  1:45   ` Cecil Westerhof
@ 2010-01-07 14:05   ` Cecil Westerhof
  2 siblings, 0 replies; 8+ messages in thread
From: Cecil Westerhof @ 2010-01-07 14:05 UTC (permalink / raw)
  To: info-gnus-english

Ted Zlatanov <tzz@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.

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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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

end of thread, other threads:[~2010-01-07 14:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-23 12:06 Some useful key bindings Cecil Westerhof
2010-01-05 19:14 ` Ted Zlatanov
2010-01-05 20:52   ` Cecil Westerhof
2010-01-06 15:31     ` Ted Zlatanov
2010-01-06 15:53       ` Cecil Westerhof
2010-01-06 21:43         ` Ted Zlatanov
2010-01-06  1:45   ` Cecil Westerhof
2010-01-07 14:05   ` Cecil Westerhof

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).