Gnus development mailing list
 help / color / mirror / Atom feed
* Bookmarking summary limit commands?
@ 2004-10-12  2:27 Cristian Gutierrez
  2004-10-12 20:34 ` Jesper Harder
  2004-10-17 12:45 ` Kai Grossjohann
  0 siblings, 2 replies; 7+ messages in thread
From: Cristian Gutierrez @ 2004-10-12  2:27 UTC (permalink / raw)


Hello, Gnusers!

Having been bitten badly by making some kibozed groups on top of *large*
maildirs, I'm getting used to gnus-summary-limit-to-<whatever> as my
"virtual inboxes" (no, it's not what nnvirtual does, just a name clash).

For example, I'm using (gnus-summary-limit-to-author "@jobdomain.com")
to only see messages from people in my job's domain, and some other
limit commands and regexps to get other "views".

But switching between these is somewhat tiresome, and cluttering the
keymap with hotkeys for each one of them is not very useful; so my
question is: Is there some way to `bookmark' a limit command/author
combo, so I can assign _one_ keybinding and use it to select what "view"
(entry on the bookmarks list) I want to apply?

Any other suggestions are also welcome, except setting up some splitting
rules :-) (I already do the splitting on the server with procmail and
sync with offlineimap).

-- 
Cristian Gutierrez			http://www.dcc.uchile.cl/~crgutier
crgutier[@]dcc.uchile.cl                        Jabber:crgutier@jabber.org

Quote from the boss: "Teamwork is a lot of people doing what 'I' say."
(Mktg. executive, Citrix Corporation) -- Dilbert Awards




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

* Re: Bookmarking summary limit commands?
  2004-10-12  2:27 Bookmarking summary limit commands? Cristian Gutierrez
@ 2004-10-12 20:34 ` Jesper Harder
  2004-10-13 20:13   ` Cristian Gutierrez
  2004-10-17 12:45 ` Kai Grossjohann
  1 sibling, 1 reply; 7+ messages in thread
From: Jesper Harder @ 2004-10-12 20:34 UTC (permalink / raw)


Cristian Gutierrez <crgutier@dcc.uchile.cl> writes:

> But switching between these is somewhat tiresome, and cluttering the
> keymap with hotkeys for each one of them is not very useful; so my
> question is: Is there some way to `bookmark' a limit command/author
> combo, so I can assign _one_ keybinding and use it to select what
> "view" (entry on the bookmarks list) I want to apply?

There's no predefined functionality.  But it's fairly straightforward
to make, e.g.

(defvar my-limit-bookmark-alist
  '(("Lars" . (gnus-summary-limit-to-author "Lars"))
    ("Not Lars" . (gnus-summary-limit-to-author "Lars" t))
    ("RSS" . (gnus-summary-limit-to-subject "rss")))
  "Alist of limit bookmarks.")

(defun my-limit-bookmark (limit)
  "Apply a limit in `my-limit-bookmark-alist'."
  (interactive
   (list (completing-read "Bookmark: " my-limit-bookmark-alist)))
  (eval (cdr (assoc limit my-limit-bookmark-alist))))

-- 
Jesper Harder                                <http://purl.org/harder/>



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

* Re: Bookmarking summary limit commands?
  2004-10-12 20:34 ` Jesper Harder
@ 2004-10-13 20:13   ` Cristian Gutierrez
  2004-10-13 21:42     ` Jesper Harder
  0 siblings, 1 reply; 7+ messages in thread
From: Cristian Gutierrez @ 2004-10-13 20:13 UTC (permalink / raw)


Jesper Harder wrote:
> Cristian Gutierrez <crgutier@dcc.uchile.cl> writes:
>
>> But switching between these is somewhat tiresome, and cluttering the
>> keymap with hotkeys for each one of them is not very useful; so my
>> question is: Is there some way to `bookmark' a limit command/author
>> combo, so I can assign _one_ keybinding and use it to select what
>> "view" (entry on the bookmarks list) I want to apply?
>
> There's no predefined functionality.  But it's fairly straightforward
> to make, e.g.

[code]

This is just nice, thank you Jesper!

I added a pop-limit command just before the actual limit command for
each entry, to be able to switch between them without manually doing
"/w" every time:

,----
| (defvar my-limit-bookmark-alist
|   '(("analytics" . (progn
|                      (gnus-summary-pop-limit)
|                      (gnus-summary-limit-to-author "analytics\\|dads")))
|     ("irf" . (progn 
|                (gnus-summary-pop-limit)
|                (gnus-summary-limit-to-author "rlemus\\|javier g")))
|     ("memoria" . (progn
|                    (gnus-summary-pop-limit)
|                    (gnus-summary-limit-to-author "cecilia\\|garreaud"))))
|   "Alist of limit bookmarks.")
`----

But now when a limit fails, I get blocked trying to switch to another
one with the message "No limit to pop" (yes, because the limit has
already been popped in the last [failed] limit).

How could I force the second command in (progn ...) to be evaluated even
if the first fails? I tried surrounding the first one in a
condition-case construct, for example:

,----
| ("analytics" . (progn
|                    (condition-case nil
|                        (gnus-summary-pop-limit)
|                      (error nil))
|                    (gnus-summary-limit-to-author "analytics\\|dads")))
`----


... but the result is the same. Any insights are appreciated.

-- 
Cristian Gutierrez			http://www.dcc.uchile.cl/~crgutier
crgutier[@]dcc.uchile.cl                        Jabber:crgutier@jabber.org

"Today's piece of secure software is the subject of tomorrow's Bugtraq
posting. -- http://www.landfield.com/isn/mail-archive/2001/Nov/0076.html




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

* Re: Bookmarking summary limit commands?
  2004-10-13 20:13   ` Cristian Gutierrez
@ 2004-10-13 21:42     ` Jesper Harder
  2004-10-14  0:23       ` Cristian Gutierrez
  0 siblings, 1 reply; 7+ messages in thread
From: Jesper Harder @ 2004-10-13 21:42 UTC (permalink / raw)


Cristian Gutierrez <crgutier@dcc.uchile.cl> writes:

> I added a pop-limit command just before the actual limit command for
> each entry, to be able to switch between them without manually doing
> "/w" every time:

You could move pop-limit down to the function instead to make the
bookmarks easier to write.

> But now when a limit fails, I get blocked trying to switch to another
> one with the message "No limit to pop" (yes, because the limit has
> already been popped in the last [failed] limit).
>
> ,----
> | ("analytics" . (progn
> |                    (condition-case nil
> |                        (gnus-summary-pop-limit)
> |                      (error nil))
> |                    (gnus-summary-limit-to-author "analytics\\|dads")))
> `----

This works for me.  Maybe you forgot to reevaluate the defvar.
Remember that evaluating a defvar, e.g. with `C-j', does not change
the value if the variable is already defined.  To set it
unconditionally you can use `C-M-x'.

-- 
Jesper Harder                                <http://purl.org/harder/>



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

* Re: Bookmarking summary limit commands?
  2004-10-13 21:42     ` Jesper Harder
@ 2004-10-14  0:23       ` Cristian Gutierrez
  0 siblings, 0 replies; 7+ messages in thread
From: Cristian Gutierrez @ 2004-10-14  0:23 UTC (permalink / raw)


Jesper Harder wrote:
> Cristian Gutierrez <crgutier@dcc.uchile.cl> writes:
>
>> I added a pop-limit command just before the actual limit command for
>> each entry, to be able to switch between them without manually doing
>> "/w" every time:
>
> You could move pop-limit down to the function instead to make the
> bookmarks easier to write.

Good idea.

[...]

> Remember that evaluating a defvar, e.g. with `C-j', does not change
> the value if the variable is already defined.  To set it
> unconditionally you can use `C-M-x'.

Couldn't be more right: I was merely doing a `C-x C-e' in front of the
defvar. Now it works flawlessly. Thanks again!

If anyone feels like trying this, here it is what I'm using now:

,----
| (defvar my-limit-bookmark-alist
|   '(("job" . (gnus-summary-limit-to-author "jobdomain.com"))
|     ("thesis" . (gnus-summary-limit-to-author "someteacher")))
|   "Alist of limit bookmarks.")
| 
| (defun my-limit-bookmark (limit)
|   "Apply a limit in `my-limit-bookmark-alist'."
|   (interactive
|    (list (completing-read "Bookmark: " my-limit-bookmark-alist)))
|   (condition-case nil
|       (gnus-summary-pop-limit)
|     (error nil))
|   (eval (cdr (assoc limit my-limit-bookmark-alist))))
| 
| (define-key gnus-summary-mode-map "/q" 'my-limit-bookmark)
`----

-- 
Cristian Gutierrez			http://www.dcc.uchile.cl/~crgutier
crgutier[@]dcc.uchile.cl                        Jabber:crgutier@jabber.org

Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!




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

* Re: Bookmarking summary limit commands?
  2004-10-12  2:27 Bookmarking summary limit commands? Cristian Gutierrez
  2004-10-12 20:34 ` Jesper Harder
@ 2004-10-17 12:45 ` Kai Grossjohann
  2004-10-18  3:09   ` Cristian Gutierrez
  1 sibling, 1 reply; 7+ messages in thread
From: Kai Grossjohann @ 2004-10-17 12:45 UTC (permalink / raw)


Cristian Gutierrez <crgutier@dcc.uchile.cl> writes:

> Any other suggestions are also welcome, except setting up some splitting
> rules :-) (I already do the splitting on the server with procmail and
> sync with offlineimap).

What is the problem with splitting?  Why would it not solve your
problem?

Excuse the silly question, but I really don't understand.

Kai



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

* Re: Bookmarking summary limit commands?
  2004-10-17 12:45 ` Kai Grossjohann
@ 2004-10-18  3:09   ` Cristian Gutierrez
  0 siblings, 0 replies; 7+ messages in thread
From: Cristian Gutierrez @ 2004-10-18  3:09 UTC (permalink / raw)


Hoy en la ma~nana, Kai Grossjohann dijo:
> Cristian Gutierrez <crgutier@dcc.uchile.cl> writes:
>
>> Any other suggestions are also welcome, except setting up some splitting
>> rules :-) (I already do the splitting on the server with procmail and
>> sync with offlineimap).
>
> What is the problem with splitting?  Why would it not solve your
> problem?
>
> Excuse the silly question, but I really don't understand.

It's not silly at all, I deliberately omitted additional info about my
mail config.

Using mail splitting wouldn't back-propagate splitted messages to the
chain of (three) servers where my messages pass through (and leave a
copy), and I've already set up the same procmail recipes in every which
of them.

Other than that, I also like the posibility of seeing all my incoming
messages in a single group. I'm aware of the nnvirtual backend, and use
it a lot to read some newsgroups with overlapping topics, but it has
some kind of trouble with nnimap (courier-imap takes *long* to set marks
on the virtualized groups).

So far, the bookmarks code Jesper helped me with works wonders :)

-- 
Cristian Gutierrez			http://www.dcc.uchile.cl/~crgutier
crgutier[@]dcc.uchile.cl                        Jabber:crgutier@jabber.org

"I dont know how to use my email." 
"You need to upgrade your IQ a few points. Try listening to classical music." 
-- Dogbert's Tech Support Service




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

end of thread, other threads:[~2004-10-18  3:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-12  2:27 Bookmarking summary limit commands? Cristian Gutierrez
2004-10-12 20:34 ` Jesper Harder
2004-10-13 20:13   ` Cristian Gutierrez
2004-10-13 21:42     ` Jesper Harder
2004-10-14  0:23       ` Cristian Gutierrez
2004-10-17 12:45 ` Kai Grossjohann
2004-10-18  3:09   ` Cristian Gutierrez

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