From: Bernard Hurley <bernard@marcade.biz>
To: notmuch@notmuchmail.org
Subject: Using notmuch with planner.
Date: Mon, 03 Dec 2012 12:45:56 +0000 [thread overview]
Message-ID: <861uf7gv7f.fsf@marcade.biz> (raw)
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
reply other threads:[~2012-12-03 12:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=861uf7gv7f.fsf@marcade.biz \
--to=bernard@marcade.biz \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).