Is there any way to change the name displayed for a group in GNUS without actually renaming the group? I read my email off of an IMAP server, and the group names are pretty ugly (e.g. nnimap+uwindsor:INBOX.) I tried using the command gnus-group-rename-group
but that attempts to change the name on the actual server. Is there any way to simply map the actual name to some local display name, to make my group buffer a little bit more readable?
Asked
Active
Viewed 744 times
9

bstamour
- 7,746
- 1
- 26
- 39
-
I expect that the parameter does not affect this particular problem, but the `(banner . REGEXP)` group parameter will strip any matches to `REGEXP` from an article... – abiessu Mar 03 '14 at 15:39
-
Hrm yeah that doesn't seem like it will do. I don't need to change the text in the articles, but the names of the groups themselves. – bstamour Mar 03 '14 at 15:40
-
Also the `(variable form)` found on [this page](http://www.gnus.org/manual/gnus_28.html#SEC28) lists ways of removing tags and such... – abiessu Mar 03 '14 at 15:41
-
3Have you adjusted the `gnus-group-line-format` variable? Note [this page](http://efod.se/writings/gnus-and-courier), especially the `NAMESPACE` section where the "user format function" is discussed. – abiessu Mar 03 '14 at 15:53
-
Oh wow, thanks. That's actually really helpful. I'll hack up some elisp later on to just map the real names to "prettier" ones, with the `%uG` technique described there. – bstamour Mar 03 '14 at 16:00
1 Answers
9
So here's how I solved the problem. First off, many thanks to abiessu for pointing me in the right direction through his comments.
(setq gnus-group-line-format "%M%S%5y/%-5t: %uG %D\n")
(defun gnus-user-format-function-G (arg)
(let ((mapped-name (assoc gnus-tmp-group group-name-map)))
(if (null mapped-name)
gnus-tmp-group
(cdr mapped-name))))
This little function simply looks up the current group name in a map I define, and if there is a "translation" it displays that instead of the actual name. Some examples that I'm using in my config are:
(setq group-name-map '(("nnimap+uwindsor:INBOX" . "School-Inbox")
("nnimap+uwindsor:[Gmail]/Starred" . "School-Starred")
("nnimap+uwindsor:[Gmail]/Sent Mail" . "School-Sent")))
Using just an alist is nice because I can create the mappings anyway I want to, without having to resort to regexes, patterns, etc.