One Weird Trick

I’ve been an emacs user since 1991, and from 1993 until 2019-06-10 I used Emacs VM mode to read email. I still use it for my personal email, but I’ve given up using it for Microsoft mail and instead started using Outlook. The most essential feature I need is what VM mode called Virtual Folders: "Virtual folders contain messages from one or more real folders (see ViewMailFolders) with various filters applied to select which messages to include." My favorite aspect of this feature was that you could use regular expressions to specify the filters.

I used the feature to craft a 7 level, prioritized new mail reading process in line with “First things first” techniques espoused by Steven Covey. When I would do my main email session of the day, I’d go through the 7 virtual folders to make sure I acted on the important emails first.

Outlook has a similar feature, called “Search Folders”. The only shortcoming appears to be that you cannot use regular expressions. That and the fact that Emacs VM had the feature in 1993, while Outlook for Windows 3.1 was only in its very early version at that point.

This blog post shows how to approximate the VM Virtual Folders feature with Outlook Search Folders.

The Emacs VM side.

The “Search Folders” help page shows how to do it, but my secret sauce is my ordered list of virtual folders, prevented in abbreviated form here. I have used the “Search Folders” feature to approximate what I had with VM. After this bunch of lisp, I’ll show how I created search folders for some of these virtual folders.

  1. (setq vm-virtual-folder-alist
  2.    '(
  3.  
  4.      ("1-urgent"
  5.       (("/home/ejburns/fmail/INBOX")
  6.        (or (subject ".*[uU][rR][gG][eE][nN][tT].*")
  7.            (subject ".*[tT][iI][mM][eE].[sS][eE][nN][sS][iI][tT][iI][vV][eE].*")
  8.            (subject ".*[vV][oO][iI][cC][eE][mM][aA][iI][lL].*[fF][rR][oO][mM].*")
  9.            (subject ".*[aA][cC][tT][iI][oO][nN].*")
  10.            (subject ".*[pP][lL][eE][aA][sS][eE].*[rR][eE][pP][lL][yY]")
  11.            (subject ".*[pP][lL][eE][aA][sS][eE].*[rR][eE][sS][pP][oO][nN][dD].*")
  12.            (subject ".*[pP][lL][eE][aA][sS][eE].*[rR][eE][aA][dD].*")
  13.            (subject ".*[mM][aA][rR][kK].*[cC][aA][lL][eE][nN][dD][aA][rR].*")
  14.            )
  15.       )
  16.  
  17.      )
  18.  
  19.      ("2-important-people-a"
  20.       (("/home/ejburns/fmail/INBOX" "/home/ejburns/fmail/.mail/issuetracker")
  21.        (or (author ".*[pP][rR][oO][dD][uU][cC][tT] [LL][iI][fF][eE][cC][yY][cC][lL][eE] [SS][uU][iI][tT][eE].*")
  22.            (author "Larry Ellison")
  23.            )
  24.       ))
  25.      ("2-important-people-b"
  26.       (("/home/ejburns/fmail/INBOX" "/home/ejburns/fmail/.mail/issuetracker")
  27.        (or
  28.            (author "Manfred Riem")
  29.            (subject ".*[bB][eE][aA][nN].*[vV][aA][lL][iI][dD][aA][tT].*")
  30.            (subject ".*[oO][iI][mM].*")
  31.            (header "X-folder: issuetracker")
  32.            )
  33.       ))
  34.  
  35.      ("3-ejburns"
  36.       (("/home/ejburns/fmail/INBOX")
  37.        (or (recipient "ed.burns@sun.com")
  38.            (recipient "edburns@java.net"))
  39.       )
  40.  
  41.      )
  42.  
  43.      ("4-dev-lists-primary"
  44.       (("/home/ejburns/fmail/.mail/dev-lists" "/home/ejburns/fmail/.mail/jsr369-experts" "/home/ejburns/fmail/.mail/jsr372-experts" "/home/ejburns/fmail/.mail/jsr362-experts")
  45.        (or
  46.         (recipient ".*jsr372-experts@javaserverfaces-spec-public.*")
  47.         (recipient ".*jsr369-experts@servlet-spec.*")
  48.         (recipient ".*dev@javaserverfaces.*")
  49.         (recipient ".*dev@facelets.*")
  50.         (recipient ".*edburns@java.net.*")
  51.         (recipient ".*nb68-jsf2-dev.*")
  52.         (recipient ".*glassfish-guerilla.*")
  53.         )
  54.       )
  55.  
  56.      )
  57.  
  58.      ("5-dev-lists-secondary"
  59.       (("/home/ejburns/fmail/.mail/dev-lists" "/home/ejburns/fmail/.mail/public_cloud_info_ww_grp")
  60.        (or (recipient ".*jsr-303-eg.*")
  61.            (recipient ".*dev@glassfish.*")
  62.            (recipient ".*jsr-ri-integration-list.*")
  63.            (recipient ".*ee6jboss-int.*")
  64.            (recipient ".*public_cloud_info_ww_grp.*")
  65.            (recipient ".*eearch@sun.com.*")
  66.            (recipient ".*[jJ][aA][vV][aA][eE][eE]_[aA][rR][cC][hH][iI][tT][eE][cC][tT][uU][rR][eE]_[wW][wW].*")
  67.            (recipient ".*el-next.*")
  68.            (recipient ".*webtier-tech@sun.com.*")
  69.            )
  70.       )
  71.  
  72.      )
  73.  
  74.      ("6-user-lists"
  75.       (("/home/ejburns/fmail/.mail/user-lists")
  76.        (or
  77.         (recipient ".*webtier@glassfish.*")
  78.         (and
  79.          (recipient ".*users@glassfish.*")
  80.          (subject ".*[jJ][sS][fF].*")
  81.              
  82.          )
  83.         (and
  84.          (recipient ".*users@glassfish.*")
  85.          (subject ".*[fF][aA][cC][eE][sS].*")
  86.          )
  87.         )
  88.        )
  89.       )
  90.  
  91.      ("7-lastMonth"
  92.       (("/home/ejburns/fmail/INBOX")
  93.        (and
  94.         (not (older-than 30))
  95.         (not (deleted))
  96.         )
  97.       )
  98.  
  99.      )
  100.  
  101.      ("8-lastWeek"
  102.       (("/home/ejburns/fmail/INBOX")
  103.        (and
  104.         (not (older-than 7))
  105.         (not (deleted))
  106.         )
  107.       )
  108.  
  109.      )
  110.  
  111.      ("9-yesterday"
  112.       (("/home/ejburns/fmail/INBOX")
  113.        (and
  114.         (not (older-than 1))
  115.         (not (deleted))
  116.         )
  117.       )
  118.  
  119.      )
  120.  
  121.      ("$-jsr-314-open"
  122.       (("/home/ejburns/fmail/.mail/dev-lists")
  123.        (or (recipient ".*jsr-314-comments.*")
  124.            (recipient ".*jsr-314-open.*")
  125.            (recipient ".*jsr-314-eg.*")
  126.            )
  127.       )
  128.  
  129.      )
  130.  
  131.       ("non-ejburns-issues"
  132.       (("/home/ejburns/fmail/.mail/issuetracker")
  133.        (not
  134.         (and
  135.          (text ".*Assignee: ejburns.*")
  136.          (text ".*Assignee: ejburns.*")
  137. )
  138.         )
  139.        )
  140.       )
  141.  
  142.  
  143.      ("lastYear"
  144.       (("/home/ejburns/fmail/INBOX")
  145.        (and
  146.         (sent-after "31 Dec 2016")
  147.         (sent-before "01 Jan 2018")
  148.         )
  149.       )
  150.  
  151.      )
  152.  
  153.  
  154.      ("myfaces"
  155.       (("/home/ejburns/fmail/INBOX")
  156.        (or (recipient ".*myfaces.*")
  157.            )
  158.       )
  159.  
  160.      )
  161.  
  162.      ("webtier-alignment"
  163.       (("/home/ejburns/fmail/INBOX")
  164.        (or (recipient ".*webtier-alignment.*")
  165.            )
  166.       )
  167.  
  168.      )
  169.  
  170.      ("jsr-252-comments"
  171.       (("/home/ejburns/fmail/INBOX")
  172.        (or (recipient ".*jsr-252-comments.*")
  173.            )
  174.       )
  175.  
  176.      )
  177.  
  178.      ("jsr-154-eg"
  179.       (("/home/ejburns/fmail/INBOX")
  180.        (or (recipient ".*servlet-spec-eg.*")
  181.            )
  182.       )
  183.  
  184.      )
  185.  
  186.      ("jsr-303-eg"
  187.       (("/home/ejburns/fmail/INBOX")
  188.        (recipient "[jJ][sS][rR]-303-[eE][gG]@[jJ][cC][pP].[oO][rR][gG]")
  189.        
  190.       ))
  191.  
  192.      ("out-of-office"
  193.       (("/home/ejburns/fmail/INBOX")
  194.        (or (subject ".*[oO][uU][tT].*[oO][fF].*[oO][fF][fF][iI][cC][eE].*")
  195.            (subject ".*[wW][fF][hH].*")
  196.            )
  197.       )
  198.  
  199.      )
  200.  
  201.      ("hudson"
  202.       (("/home/ejburns/fmail/INBOX")
  203.        (or (subject ".*[hH][uU][dD][sS][oO][nN].*")
  204.            (subject ".*[jJ][eE][nN][kK][iI][nN][sS].*")
  205.            (author ".*[hH][uU][dD][sS][oO][nN].*")
  206.            (author ".*[jJ][eE][nN][kK][iI][nN][sS].*")
  207.            (author ".*[oO][dD][xX][ ][gG][iI][tT][lL][aA][bB].*")
  208.            )
  209.       )
  210.  
  211.      )
  212.  
  213.      ("bugdb"
  214.       (("/home/ejburns/fmail/INBOX")
  215.        (or (author ".*[bB][uU][gG][dD][bB].*")
  216.            )
  217.       )
  218.  
  219.      )
  220.  
  221.      ("github"
  222.       (("/home/ejburns/fmail/INBOX")
  223.        (or (author ".*[nN][oO][tT][iI][fF][iI][cC][aA][tT][iI][oO][nN][sS]@[gG][iI][tT][hH][uU][bB].[cC][oO][mM].*")
  224.            )
  225.       )
  226.  
  227.      )
  228.  
  229.      ("confluence"
  230.       (("/home/ejburns/fmail/INBOX")
  231.        (or (author ".*[cC][oO][nN][fF][lL][uU][eE][nN][cC][eE].*")
  232.            )
  233.       )
  234.  
  235.      )
  236.      ("git"
  237.       (("/home/ejburns/fmail/INBOX")
  238.        (or (author ".*[eE][sS][eE] [sS][uU][pP][pP][oO][rR][tT].*")
  239.            )
  240.       )
  241.  
  242.      )
  243.      ("commits"
  244.       (("/home/ejburns/fmail/INBOX")
  245.        (or (recipient ".*commits@.*java.net.*")
  246.            (recipient ".*cvs@.*java.net.*")
  247.            )
  248.            
  249.       )
  250.  
  251.      )
  252.      ("jira"
  253.       (("/home/ejburns/fmail/INBOX")
  254.        (or (author ".*[jJ][iI][rR][aA].*")
  255.            (subject "ODCS:.*")
  256.            (subject ".*[wW][eE][bB][lL][oO][gG][iI][cC].*")
  257.            )
  258.       )
  259.  
  260.      )
  261.  
  262.      ("calendar"
  263.       (("/home/ejburns/fmail/INBOX")
  264.        (or (subject ".*[mM][eE][eE][tT][iI][nN][gG] [iI][nN][vV][iI][tT][eE].*")
  265.            (subject ".*[MM][eE][eE][tT][iI][nN][gG] [WW][iI][tT][hH][dD][rR][aA][wW][nN].*")
  266.            (subject ".*[MM][eE][eE][tT][iI][nN][gG] [UU][pP][dD][aA][tT][eE][dD].*")
  267.            )
  268.       )
  269.  
  270.      )
  271.  
  272.      ("jenkins"
  273.       (("/home/ejburns/fmail/INBOX")
  274.        (or (author ".*[jJ][eE][nN][kK][iI][nN][sS].*")
  275.            )
  276.       )
  277.  
  278.      )
  279.  
  280.  
  281.    )
  282. )
  283.  

I only use the “numbered” virtual folders in my daily email scan. But if you have an enormous volume of incoming mail, as I did when I was the spec lead of several JSRs at the same time, the other ones were very helpful. I will say that since the advent of tools like Slack and Microsoft Teams, the volume of email is less.

The Outlook Side

Create your First Search Folder: 1-urgent

Click the “Folder” menu, then the “New Search Folder” button, as shown next.

New Search Folder

In the “New Search Folder” dialog that appears, scroll the content of the “Select a Search Folder” pane down to the bottom and select “Create a custom Search Folder”. Click “Choose…”.

In the “Name” field, type 1-urgent.

Click the “Browse…” button just beneath the “Mail from these folders will be included in this Search Folder: heading. Uncheck the ridiculously tiny little checkbox next to your account name and check the ridiculously tiny little checkbox next to “Inbox”. Make sure “Search subfolders” is checked, as shown next.

Select Folder(s)

This is important, otherwise you’ll see “Deleted”, “Sent”, “Drafts”, “Junk” and other undesirable nonsense in your Search Folders. Click “OK”.

Click “Criteria”. Selct the “More Choices” Tab. Check the checkbox next to “Only items that are:” and change the value to “unread”. If you neglect this step you’ll see things you’ve already seen, which defeats the purpose of the exercise.

Select the “Advanced” tab. Drop down the “Field” menu, mouse over “Frequently-used fields”, and mouse over to “Subject”. Click on “Subject”. Leave the “Condition” as contains. In the value enter “urgent”. Click “Add to List”.

Do this again and again for lines 6 - 13 in the lisp above. The matches are case-insensitive by default, and this thing doesn’t appear to accept regexp anyway, so that’s why you don’t need the goofy looking .*[uU][rR][gG][eE][nN][tT].* type syntax. However, as you’ll see, this is a lot more clicking than just writing some simple regexps. I’d rather the regexps.

After adding all the subject variants click “OK”, then click “OK” again. This will cause the “1-urgent” Search folder to appear in the “Search Folders” section on the left navigation, as shown next.

Left Nav

I like to add the Search Folders to my favorites. To do this, right click on the Search Folder and choose “Add to Favorites”.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Create Your Second Search Folder: 2-important-people-a

Right click the “Search Folders” heading in the left nav bar and choose “New Search Folder”. Type the name “2-important-people-a” and do the “Browse…” ridiculously tiny little checkbox trick again.

Click “Criteria”. Select the “Advanced” tab. Drop down the “Field” menu, mouse over “Address fields”, and mouse over to “From”. Click on “From”. Leave the “Condition” as contains. In the value enter the name of the important person. Click “Add to List”.

After adding all the important people, click “OK”, then click “OK” again. This will cause the “2-important-people-a” Search folder to appear in the “Search Folders” section on the left navigation. Add this to the favorites as well.

Create Your Third Search Folder: 2-important-people-b

This is just the same as the preceding step, but for people that are not as important to you as important-people-a. I find having two levels of important people is enough for me, but YMMV. I tend to put bosses and their bosses in the “a” category and my important collaborators in the “b” category. Everyone else falls into the timed categories I’ll show later.

Create Your Fourth Search Folder: 3-<your name>

This folder is for messages sent directly to you, not messages that you receive by virtue of being on a mailing list.

Create this using the steps as for the preceding Search Folders, but when you get to the “Criteria” step, it’s different. In the “Messages” tab, In the text field next to “Sent To…”, fill in a semicolon separated list of the identifiers for your email address. In my case, I put Ed Burns <Edward.Burns@microsoft.com>; Edward Burns; edburns@microsoft.com; edward.burns@microsoft.com because these are all I can be reached.

Create the “date based” Search Folders: 7-lastMonth, 8-lastWeek, 9-yesterday

Create these folders in a similar fashion as above, but when you get to criteria selection, Drop down the “Field” menu, mouse over “Date/Time fields”, and mouse over to “Sent”. Click on “Sent”. Change the value of “Condition” to “Last Month”. Click “Add to List”. Click “OK” and “OK”.

Create Search Folders for “Last Week” and “Yesterday” in a similar manner.

Summary

One of the rockstar programmer skills I found is “mastery of tools”. All of us, not just programmers, need to have mastery of email. I hope this one weird trick helps you save time on email.