[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yet another maildir question

From: Jesse F. Hughes
Subject: Re: Yet another maildir question
Date: Fri, 23 Jul 2004 23:41:42 +0200
User-agent: Gnus/5.090017 (Oort Gnus v0.17) XEmacs/21.4 (Reasonable Discussion, linux)

johnsu01 <address@hidden> writes:

> It only prettifies the Group buffer. But, yeah, tab completion is
> still off the original name. I didn't write those original
> functions---but that sure would be a nice feature to add.

I haven't written those functions either, but I altered your functions

Here is the now badly-named lookup function and my translation table.
Notice that I allow regular expressions in the first position.  In the
second position, you can replace text with the corresponding match
from the first.  So, a group like "lists.humor" shows up just as
"humor".  It's a little nicer for me, since I often subscribe to a
list for only a brief period and I don't feel like editing the table
every time that happens.

Probably there is a much nicer way to write the lookup function.

(setq gnus-group-translation-table
  '(("trash.bogofilter$" "Trash (bogofilter)")
    ("trash$" "Trash")
    ("egowatch$" "Usenet alert")
    ("tue$" "TU/E misc.")
    ("lists.fom$" "FOM")
    ("lists\\.\\(.*\\)" "\\1")
    ("newsgroup.chats$" "Usenet chats")
    ("newsgroup.chats.gnus$" "Gnus chats")
    ("newsgroup.chats.Linux$" "Linux chats")
    ("tue.research$" "Research")))

(defun lookup-by-tail (string matchers)
  (let ((replacements
         (mapcar #'(lambda (matcher)
                      (let* ((rexp (car matcher))
                             (then-expr (cadr matcher)))
                        (if (string-match rexp string)
                            (let ((i 0)
                                  (ret ""))
                              (while (< i (length then-expr))
                                (if (char= (aref then-expr i) ?\\ )
                                      (setq i (+ i 1))
                                      ;; Should be at a digit now.
                                      (setq num 
                                             (char-to-string (aref then-expr 
                                      (setq ret 
                                            (concat ret (match-string num 
                                  (setq ret 
                                        (concat ret 
                                                (char-to-string (aref then-expr 
                                (setq i (+ i 1)))
    (find-if 'identity replacements)))
"By initially making it virtually impossible to maintain a heterogenous
environment of Word 95 and Word 97 systems, Microsoft offered its customers
that most eloquent of arguments for upgrading: the delicate sound of a
revolver being cocked somewhere just out of sight."  --Dan Martinez

reply via email to

[Prev in Thread] Current Thread [Next in Thread]