Using notmuch with planner.
authorBernard Hurley <bernard@marcade.biz>
Mon, 3 Dec 2012 12:45:56 +0000 (12:45 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:22 +0000 (09:51 -0800)
1a/568bd707b41498c10b01d7c639c78842283fd5 [new file with mode: 0644]

diff --git a/1a/568bd707b41498c10b01d7c639c78842283fd5 b/1a/568bd707b41498c10b01d7c639c78842283fd5
new file mode 100644 (file)
index 0000000..f1dddf5
--- /dev/null
@@ -0,0 +1,106 @@
+Return-Path: <bernard@marcade.biz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id CA8B1431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Dec 2012 04:55:02 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.275\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.275 tagged_above=-999 required=5\r
+       tests=[FSL_HELO_NON_FQDN_1=0.001, HELO_NO_DOMAIN=1, RDNS_NONE=1.274]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id xXyHpYqTNQVL for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Dec 2012 04:55:02 -0800 (PST)\r
+X-Greylist: delayed 525 seconds by postgrey-1.32 at olra;\r
+       Mon, 03 Dec 2012 04:55:02 PST\r
+Received: from dell-laptop (unknown [86.53.51.141])\r
+       by olra.theworths.org (Postfix) with ESMTP id 27209431FBC\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Dec 2012 04:55:02 -0800 (PST)\r
+Received: by dell-laptop (Postfix, from userid 1001)\r
+       id 02097BD6058; Mon,  3 Dec 2012 12:45:56 +0000 (GMT)\r
+From: Bernard Hurley <bernard@marcade.biz>\r
+To: notmuch@notmuchmail.org\r
+Subject: Using notmuch with planner.\r
+User-Agent: Notmuch/0.14 (http://notmuchmail.org) Emacs/24.2.1\r
+       (i686-pc-linux-gnu)\r
+X-Attribution: Bernard\r
+Date: Mon, 03 Dec 2012 12:45:56 +0000\r
+Message-ID: <861uf7gv7f.fsf@marcade.biz>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 03 Dec 2012 12:55:02 -0000\r
+\r
+Hi all,\r
+\r
+I have been using the following code for stashing link to email messages\r
+for use in planner. It might be of use to others on the list.\r
+\r
+Bernard\r
+\r
+;; Code for using notmuch with planner\r
+(defun notmuch-show-get-planner-link ()\r
+  "Get a planner-formatted link to a notmuch-show email message.\r
+The format of the link is:\r
+\r
+   [[<subject>]], <date>, <from>.\r
+   \r
+The subject field is suitably edited to remove any characters\r
+that would break the coding of the link. The text of the Date:\r
+and From: fields are also also copied to the kill ring as the\r
+user will most probably need them.\r
+"\r
+  ;; Make sure planner understands lisp coded links\r
+  (require 'planner-lisp)\r
+  (let ((id (concat "id:" (notmuch-show-get-message-id t)))\r
+       (subject (notmuch-show-get-subject))\r
+       (date (notmuch-show-get-date))\r
+       (from (notmuch-show-get-from))\r
+       title link-code link)\r
+    ;; Replace awkward characters in subject\r
+    (setq title (replace-regexp-in-string "\"" "'" subject))\r
+    (setq title (replace-regexp-in-string "\\[" "{" subject))\r
+    (setq title (replace-regexp-in-string "\\]" "}" subject))\r
+    ;; Construct the title of the show buffer\r
+    (setq title (concat "*"\r
+                       (truncate-string-to-width subject 30 nil nil t)\r
+                       "*"))\r
+    ;; Construct link code\r
+    (setq link-code\r
+         (format "lisp:/(notmuch-show \"%s\" (current-buffer) nil \"%s\")"\r
+                 id\r
+                 title))\r
+    ;; Construct link\r
+    (setq link\r
+         (format "[[%s][%s]], %s, %s." link-code subject date from))))\r
+          \r
+(defun notmuch-show-stash-planner-link ()\r
+  "Planner-formatted link to notmuch-show email message to kill ring."\r
+  (interactive)\r
+  (notmuch-common-do-stash (notmuch-show-get-planner-link)))\r
+  \r
+-- \r
+\r
+Your fortune cookie for today:\r
+\r
+A bore is a man who talks so much about himself that you can't talk about\r
+yourself.\r
+\r
+** Fortune cookies are brought to you by GNU/Linux "fortunes" **\r
+\r
+>  LocalWords:  notmuch defun concat setq\r