Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the display name of a GNUS group

Tags:

emacs

imap

gnus

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?

like image 518
bstamour Avatar asked Mar 03 '14 15:03

bstamour


1 Answers

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.

like image 107
bstamour Avatar answered Oct 15 '22 12:10

bstamour