aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-05-01 15:35:11 +0300
committerGravatar David Bremner <david@tethera.net>2014-05-04 14:16:24 +0900
commitecef282a168019e03424bddf0a56053e1dd9a6fe (patch)
treeebb3f6ca9f3aef6dc2d5e5e473f6a479cfdd9d89 /emacs
parent21cb851a22f41e0b2a7c07dcbcc4f2dec20a0e3d (diff)
emacs: allow functions in notmuch-show-stash-mlarchive-link-alist
Some archives may use a more complicated scheme for referring to messages than just concatenated url and message-id. In particular, patchwork requires a query to translate message-id to a patchwork patch id. Allow functions in notmuch-show-stash-mlarchive-link-alist to facilitate this. For example, one could use something like this for patchwork. (lambda (message-id) (concat "http://patchwork.example.com/patch/" (nth 0 (split-string (car (last (process-lines "pwclient" "search" "-n" "1" "-m" (concat "<" message-id ">"))))))))
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el40
1 files changed, 27 insertions, 13 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index df10d4ba..10fc8721 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -180,10 +180,21 @@ each attachment handler is logged in buffers with names beginning
)
"List of Mailing List Archives to use when stashing links.
-These URIs are concatenated with the current message's
-Message-Id in `notmuch-show-stash-mlarchive-link'."
+This list is used for generating a Mailing List Archive reference
+URI with the current message's Message-Id in
+`notmuch-show-stash-mlarchive-link'.
+
+If the cdr of the alist element is not a function, the cdr is
+expected to contain a URI that is concatenated with the current
+message's Message-Id to create a ML archive reference URI.
+
+If the cdr is a function, the function is called with the
+Message-Id as the argument, and the function is expected to
+return the ML archive reference URI."
:type '(alist :key-type (string :tag "Name")
- :value-type (string :tag "URL"))
+ :value-type (choice
+ (string :tag "URL")
+ (function :tag "Function returning the URL")))
:group 'notmuch-show)
(defcustom notmuch-show-stash-mlarchive-link-default "Gmane"
@@ -2055,16 +2066,19 @@ This presumes that the message is available at the selected Mailing List Archive
If optional argument MLA is non-nil, use the provided key instead of prompting
the user (see `notmuch-show-stash-mlarchive-link-alist')."
(interactive)
- (notmuch-common-do-stash
- (concat (cdr (assoc
- (or mla
- (let ((completion-ignore-case t))
- (completing-read
- "Mailing List Archive: "
- notmuch-show-stash-mlarchive-link-alist
- nil t nil nil notmuch-show-stash-mlarchive-link-default)))
- notmuch-show-stash-mlarchive-link-alist))
- (notmuch-show-get-message-id t))))
+ (let ((url (cdr (assoc
+ (or mla
+ (let ((completion-ignore-case t))
+ (completing-read
+ "Mailing List Archive: "
+ notmuch-show-stash-mlarchive-link-alist
+ nil t nil nil
+ notmuch-show-stash-mlarchive-link-default)))
+ notmuch-show-stash-mlarchive-link-alist))))
+ (notmuch-common-do-stash
+ (if (functionp url)
+ (funcall url (notmuch-show-get-message-id t))
+ (concat url (notmuch-show-get-message-id t))))))
(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)
"Copy an ML Archive URI for the current message to the kill-ring and visit it.