Hi all, I have been using the following code for stashing link to email messages for use in planner. It might be of use to others on the list.
Bernard ;; Code for using notmuch with planner (defun notmuch-show-get-planner-link () "Get a planner-formatted link to a notmuch-show email message. The format of the link is: [[<subject>]], <date>, <from>. The subject field is suitably edited to remove any characters that would break the coding of the link. The text of the Date: and From: fields are also also copied to the kill ring as the user will most probably need them. " ;; Make sure planner understands lisp coded links (require 'planner-lisp) (let ((id (concat "id:" (notmuch-show-get-message-id t))) (subject (notmuch-show-get-subject)) (date (notmuch-show-get-date)) (from (notmuch-show-get-from)) title link-code link) ;; Replace awkward characters in subject (setq title (replace-regexp-in-string "\"" "'" subject)) (setq title (replace-regexp-in-string "\\[" "{" subject)) (setq title (replace-regexp-in-string "\\]" "}" subject)) ;; Construct the title of the show buffer (setq title (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")) ;; Construct link code (setq link-code (format "lisp:/(notmuch-show \"%s\" (current-buffer) nil \"%s\")" id title)) ;; Construct link (setq link (format "[[%s][%s]], %s, %s." link-code subject date from)))) (defun notmuch-show-stash-planner-link () "Planner-formatted link to notmuch-show email message to kill ring." (interactive) (notmuch-common-do-stash (notmuch-show-get-planner-link))) -- Your fortune cookie for today: A bore is a man who talks so much about himself that you can't talk about yourself. ** Fortune cookies are brought to you by GNU/Linux "fortunes" ** > LocalWords: notmuch defun concat setq