* gnus-group-line-format questions
@ 2002-10-03 4:58 John H Palmieri
2002-10-03 6:10 ` Danny Siu
0 siblings, 1 reply; 3+ messages in thread
From: John H Palmieri @ 2002-10-03 4:58 UTC (permalink / raw)
I have two questions about formatting lines in the Group buffer:
1. Is it possible to use different formatting for different parts of
the buffer? For instance, I would like lines for mail groups
formatted differently from news groups.
2. I happen to have mail groups with names like "Mail/IMAP/gnus", and
I would like them to be displayed without the "Mail/IMAP/" part.
Is that possible?
I guess both of these might be doable if there were a
user-customizable specifier that takes the group name as an argument,
but I don't think there is such a thing. Or is there? Can I access
the group name somehow within gnus-user-format-function-X? Or can I
use "Advanced Formatting" somehow (something like %~(form
(gnus-group-group-name)))?
(Would it make sense if gnus-user-format-function-X were passed the
group name, when used in gnus-group-line-format? As it is, I think
it's just a dummy variable, carrying no information.)
--
J. H. Palmieri
Dept of Mathematics, Box 354350 mailto:palmieri@math.washington.edu
University of Washington http://www.math.washington.edu/~palmieri/
Seattle, WA 98195-4350
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gnus-group-line-format questions
2002-10-03 4:58 gnus-group-line-format questions John H Palmieri
@ 2002-10-03 6:10 ` Danny Siu
2002-10-03 19:44 ` John H Palmieri
0 siblings, 1 reply; 3+ messages in thread
From: Danny Siu @ 2002-10-03 6:10 UTC (permalink / raw)
John,
I defined a custom format function for displaying my IMAP mail group names
in group buffer. Notice that "%(%-20uG%)" in my gnus-group-line-format.
(setq gnus-group-line-format "%m%M%S%P%2L [!%-3T ?%-3I] %4y: %(%-20uG%) %20ue\n")
;; Just the trailing group name
(defun gnus-user-format-function-G (arg)
(if (string-match "/[^/]+$" gnus-tmp-qualified-group)
(substring gnus-tmp-qualified-group (+ (match-beginning 0) 1))
gnus-tmp-qualified-group))
This is related but not exactly what you are looking for but you may find
useful when dealing with long IMAP folder name.
I have a rather long custom function for splitting mails with nnfolders,
which uses a flat single level mailboxe naming convention. But after
switching to IMAP, I reorganized my 100+ mailboxes into sub-folders and it
would be a pain for me to fix up my custom mail split function. Rather, I
wrote the following defadvice to patch up my original mail split function
for matching the correspoding IMAP mailboxes, assuming each and all IMAP
mailboxes has unique name.
(defun dsiu-gnus-all-groups (method &optional remove)
(let ((alist gnus-newsrc-alist)
(prefix (regexp-quote (gnus-group-prefixed-name "" method)))
groups
group match)
(while (setq group (car (pop alist)))
(when (string-match prefix group)
(setq groups (cons (if remove (substring group (match-end 0)) group) groups))))
(reverse groups)))
(defun dsiu-gnus-find-canonical-group (method group)
(let ((alist (dsiu-gnus-all-groups method t))
(ends (concat "/" (regexp-quote group) "$"))
(found nil)
cg)
(while (and (not found)
(setq cg (pop alist)))
(setq found (string-match ends cg)))
(if found cg group)))
(defun dsiu-gnus-get-imap-method ()
(list (quote nnimap)
(eval (cadr (assoc 'nnimap gnus-secondary-select-methods)))))
(defadvice split-dannys-mail (after canonicalize-imap-group-name activate)
"patch my split function to use canonical imap group name"
(let ((orig ad-return-value))
(setq ad-return-value
(list (dsiu-gnus-find-canonical-group (dsiu-gnus-get-imap-method)
(car ad-return-value))))))
Hope this helps,
--
Danny Siu
John H Palmieri writes:
John> I have two questions about formatting lines in the Group buffer:
John> 1. Is it possible to use different formatting for different parts of
John> the buffer? For instance, I would like lines for mail groups
John> formatted differently from news groups.
John> 2. I happen to have mail groups with names like "Mail/IMAP/gnus",
John> and I would like them to be displayed without the "Mail/IMAP/"
John> part. Is that possible?
John> I guess both of these might be doable if there were a
John> user-customizable specifier that takes the group name as an
John> argument, but I don't think there is such a thing. Or is there?
John> Can I access the group name somehow within
John> gnus-user-format-function-X? Or can I use "Advanced Formatting"
John> somehow (something like %~(form (gnus-group-group-name)))?
John> (Would it make sense if gnus-user-format-function-X were passed the
John> group name, when used in gnus-group-line-format? As it is, I think
John> it's just a dummy variable, carrying no information.)
John> --
John> J. H. Palmieri
John> Dept of Mathematics, Box 354350 mailto:palmieri@math.washington.edu
John> University of Washington http://www.math.washington.edu/~palmieri/
John> Seattle, WA 98195-4350
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gnus-group-line-format questions
2002-10-03 6:10 ` Danny Siu
@ 2002-10-03 19:44 ` John H Palmieri
0 siblings, 0 replies; 3+ messages in thread
From: John H Palmieri @ 2002-10-03 19:44 UTC (permalink / raw)
Thanks, this is more or less exactly what I wanted. In particular,
knowing that I have access to the variable gnus-tmp-qualified-group
lets me do just the sort of thing I want.
Danny Siu <dsiu@adobe.com> writes:
> John,
>
> I defined a custom format function for displaying my IMAP mail group names
> in group buffer. Notice that "%(%-20uG%)" in my gnus-group-line-format.
>
> (setq gnus-group-line-format "%m%M%S%P%2L [!%-3T ?%-3I] %4y: %(%-20uG%) %20ue\n")
>
> ;; Just the trailing group name
> (defun gnus-user-format-function-G (arg)
> (if (string-match "/[^/]+$" gnus-tmp-qualified-group)
> (substring gnus-tmp-qualified-group (+ (match-beginning 0) 1))
> gnus-tmp-qualified-group))
>
>
> This is related but not exactly what you are looking for but you may find
> useful when dealing with long IMAP folder name.
--
J. H. Palmieri
Dept of Mathematics, Box 354350 mailto:palmieri@math.washington.edu
University of Washington http://www.math.washington.edu/~palmieri/
Seattle, WA 98195-4350
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-10-03 19:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03 4:58 gnus-group-line-format questions John H Palmieri
2002-10-03 6:10 ` Danny Siu
2002-10-03 19:44 ` John H Palmieri
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).