Problem -- adding an attribute indicator in the vm summary buffer for emails I have org mode-captured some action/actions from. Due to old age(?) I now and then tend to forget if I have added items on my GTD-lists from an email, which sometime generates duplicate items or more...
The quick solution I came up with was to
- add a user-defined label, captured, to the email I just captured some action from, and
- modify the vm summary format with a user defined specifier to show the character C next to the attribute indicators if the email has the captured label.
The first step was really really easy thanks to
org-capture-after-finalize-hook
, in
.emacs
I did
;; Add a hook to the label-setting-function.
(add-hook 'org-capture-after-finalize-hook
'ra/vm-add-captured-message-label)
;; Add a label to the current email, may also reside in .vm
(defun ra/vm-add-captured-message-label ()
"Adds the \"captured\" label to the current email."
(if (equal "mairix" (plist-get org-store-link-plist :type))
;;
;; if you do not use mairix-type links you can
;; - comment out the equal-condition above, and
;; - comment in the or-condition below.
;;
;; (or (eq major-mode 'vm-summary-mode)
;; (eq major-mode 'vm-presentation-mode))
;;
(vm-add-message-labels "captured" 1)))
The second step was also quite straight forward, in
.vm
I added
;; VM summary template
(setq vm-summary-format
"%n %*%a%1UC %-17.17F %-3.3m %2d %S %I\"%s\"\n")
;; VM summary function C
(defun vm-summary-function-C (message)
"Given a VM message, returns a \"C\" if it has been labelled
\"captured\"."
(if (member "captured" (vm-labels-of message))
"C"
""))
In the
vm-summary-format
template above, note the sequence
%a%1UC
where
%a
is the usual attribute indicators, and
%1UC
is where the vm-summary-function-C
is called and my custom "attribute indicator", the single C
character, may be inserted.
To conclude -- I did not add a new attribute and attribute indicator, but my own custom user-defined label,
captured, and my own custom user-defined label indicator,
C.
This solution is far from perfect, eg capturing anything else while being in a vm summary or presentation buffer will get the current email labelled. An alternative would then be to create a new capture template and key combo for capturing emails... but that will probably mess things up for me, hitting the correct combo in the correct buffer... :P
Finally a rowshot from vm summary after capturing, indicator R for replied and C for captured:
-> 6 R C Robert Adesam Jun 21 50 "Emacs for Linguists"