Map of Emacs Users

Add yourself to the Map of Emacs Users around the world… and leave a note with the emacsen version(s) you use, just for the fun of it! You can also take a look at Emacs google trends (or the Emacs vs. that other editor one), the EmacsUserLocations page or this Emacs Screenshots flickr group.

Posted in Fun. 2 Comments »

Gmail envy

Gmail markers Although Gnus is my primary mail reader, there’s lots of things i like about Gmail (actually, Gmail is my primary inbox: Gnus reads mail from there). For instance, a little feature i love in Gmail is those markers that tell you whether you’re one of the direct recipients of a mail. When seeing a long list of mails in a mail list, i can quickly identify those with me explicitly in the To: or Cc: headers: chances are i’m slightly more interested in them.

In Gnus, one can customize the information shown in the message list by tweaking the variable gnus-summary-line-format. If you press C-h v gnus-summary-line-format to see all the formatting options, you’ll see there’s a lot of information to be shown, but not the one we want. But, as is always the case, we have a hook to extend the format to our hearts content: the %uX directive, where X is any letter you want. When Gnus sees that directive, it calls gnus-user-format-function-X, a function you must write returning a string that gets inserted in the summary line. So here we go: first i define a string with a regexp of my email addresses:

(defvar *jao-mails* 
        "jao@foo\\.org\\|jao@baz\\.com\\|jao@grogle\\.com")

and then i function which returns a “»” if i’m the only recipient of the message, or a “~” if i’m in the To:, Cc: or BCc: headers among others:

(defun gnus-user-format-function-j (headers)
  (let ((to (gnus-extra-header 'To headers)))
    (if (string-match *jao-mails* to)
        (if (string-match "," to) "~" "»")
        (if (or (string-match *jao-mails* 
                              (gnus-extra-header 'Cc headers))
                (string-match *jao-mails* 
                              (gnus-extra-header 'BCc headers)))
            "~"
            " "))))

Then all that is left is using it in my gnus-summary-line-format:

(setq
 gnus-summary-line-format
 "%U%R %~(pad-right 2)t%* %uj %B%~(max-right 20)~(pad-right 20)n %s\n")

Picture 2.pngNotice the %uj doing the trick here. I’m sure you’ll come up with other uses to this extension mechanism, which, by the way, is also available for gnus-group-line-format, the variable governing how lines in the *Group* buffer are displayed.

Posted in Gnus. 6 Comments »