Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CA8B1431FAE for ; Mon, 3 Dec 2012 04:55:02 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 2.275 X-Spam-Level: ** X-Spam-Status: No, score=2.275 tagged_above=-999 required=5 tests=[FSL_HELO_NON_FQDN_1=0.001, HELO_NO_DOMAIN=1, RDNS_NONE=1.274] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xXyHpYqTNQVL for ; Mon, 3 Dec 2012 04:55:02 -0800 (PST) X-Greylist: delayed 525 seconds by postgrey-1.32 at olra; Mon, 03 Dec 2012 04:55:02 PST Received: from dell-laptop (unknown [86.53.51.141]) by olra.theworths.org (Postfix) with ESMTP id 27209431FBC for ; Mon, 3 Dec 2012 04:55:02 -0800 (PST) Received: by dell-laptop (Postfix, from userid 1001) id 02097BD6058; Mon, 3 Dec 2012 12:45:56 +0000 (GMT) From: Bernard Hurley To: notmuch@notmuchmail.org Subject: Using notmuch with planner. User-Agent: Notmuch/0.14 (http://notmuchmail.org) Emacs/24.2.1 (i686-pc-linux-gnu) X-Attribution: Bernard Date: Mon, 03 Dec 2012 12:45:56 +0000 Message-ID: <861uf7gv7f.fsf@marcade.biz> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2012 12:55:02 -0000 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: [[]], , . 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