$ cat "

Emacs Kata #2: Making Sense of an Outlook Meeting Attendees List

"

One of my pet peeves with Microsoft Outlook is that there is no decent way to sort/filter/print/output/watever for the attendee list of a meeting. Because of this I always end up doing those things in emacs instead.

Todays task is to take this attendee list:


Name Attendance Response
Allen Key Meeting Organizer None
Bob Sled Required Attendee Accepted
Clay Pigeon Required Attendee Accepted
Cliff Edge Required Attendee Accepted
Guy Ropes Required Attendee Accepted
Jack Hammer Required Attendee Accepted
Jerry Cann Required Attendee Declined
Jim Boot Required Attendee Accepted
Jim Equipment Required Attendee Accepted
Jock Strap Required Attendee Accepted
Lou Paper Required Attendee Accepted
Mike Stand Required Attendee Declined
Morris Minor Required Attendee Accepted
Phillip Screwdriver Required Attendee Accepted
Ray Gunn Required Attendee Accepted
Roman Bath Required Attendee Accepted
Stanley Knife Required Attendee Accepted
Terry Towelling Required Attendee Accepted
Walter Closet Required Attendee Accepted
Catherine Wheel Required Attendee Declined
Joy Stick Required Attendee Accepted
Kitty Litter Required Attendee Accepted
Pearl Necklace Required Attendee Accepted
Penny Farthing Required Attendee Declined
Jim Nazium Required Attendee Declined
Jack Pott Required Attendee Accepted
Noah Zark Required Attendee Declined
Cain Basket Required Attendee Accepted
Barb Dwyer Required Attendee Accepted
Helmut Strap Required Attendee Accepted
Jim Shorts Required Attendee None
Peg Basket Required Attendee Accepted
Col Pitt Required Attendee Accepted
Cec Pitt Required Attendee None
Mary Goround Required Attendee Accepted
Annette Curtain Required Attendee None
Brandon Iron Required Attendee None
Mike Rowe-chip Required Attendee Accepted
Lucy Lastic Required Attendee Accepted

and transform it into this:


Name Response
Allen Key None
Bob Sled Accepted
Clay Pigeon Accepted
Cliff Edge Accepted
Guy Ropes Accepted
Jack Hammer Accepted
Jim Boot Accepted
Jim Equipment Accepted
Jock Strap Accepted
Lou Paper Accepted
Morris Minor Accepted
Phillip Screwdriver Accepted
Ray Gunn Accepted
Roman Bath Accepted
Stanley Knife Accepted
Terry Towelling Accepted
Walter Closet Accepted
Joy Stick Accepted
Kitty Litter Accepted
Pearl Necklace Accepted
Jack Pott Accepted
Cain Basket Accepted
Barb Dwyer Accepted
Helmut Strap Accepted
Peg Basket Accepted
Col Pitt Accepted
Mary Goround Accepted
Mike Rowe-chip Accepted
Lucy Lastic Accepted

Jim Shorts None
Cec Pitt None
Annette Curtain None
Brandon Iron None

So, in other words, the task is to remove all the attendees that declined, remove the Attendance column, and group the attendees with "None" as response (except for the meeting organizer) at the bottom.

My solution:
- Align everything into proper columns with the align-repeat command using tab as separator (use "C-q i" to enter a tab in the regex)
- Delete all lines with Declined as response using the flush lines command specifying the regex ".*Declined$"
- Sort the attendees with Accepted as response, so that the None responses end up at the bottom. This is done using the sort-fields command with -1 as argument (C-u -1 followed by M-x sort-fields). -1 tells emacs to sort using the right most column.
- Delete the attendance column using rectangle selection, C-x r d to delete the selected rectangle
- Add a blank line before the group of attendees with None as response

Written by Erik Öjebo 2012-12-02 14:06

    Comments