--- /dev/null
+Return-Path: <jani@nikula.org>\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 97D36431FBF\r
+ for <notmuch@notmuchmail.org>; Tue, 29 Apr 2014 01:45:34 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 mbQeX2aehBcW for <notmuch@notmuchmail.org>;\r
+ Tue, 29 Apr 2014 01:45:29 -0700 (PDT)\r
+Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com\r
+ [74.125.82.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ A478F431FBD for <notmuch@notmuchmail.org>; Tue, 29 Apr 2014 01:45:29 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f42.google.com with SMTP id k14so4756170wgh.1\r
+ for <notmuch@notmuchmail.org>; Tue, 29 Apr 2014 01:45:27 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
+ bh=Gxa/5jxSAQO6JQchZRVM5nQhHJGvBk0B4sb9mzOy4Do=;\r
+ b=lC+d5FW7X6tQLDvWJkOw0OAg2lRFbbX0g9JAkaRnfKnh9ZFJ+44GjIUvEMcqFSZO/R\r
+ Qv7jMcjV+QlOWUIUYhExyxV71ONrkhkBKvCpRM0BqLCsTBQe5Vep3dJIhFpT4b4Bl0C6\r
+ zDcmfC3SxPThr5LcavXmEQsgoPMUd/W1uUBmF+RdzrHZhI6zIJrthjB9bmRS4j3FhLl6\r
+ HZXqnc/me9Iw4sBpZun9BRw5M+ATi15xic9zir6KKmg5ysW6HEstyZeaDWeOYq9JY0GA\r
+ cYuArNJNvyKBMZVAGRM0FmCSMjw4jXbfpElq6qRL8MEejF9Rc7pTvTDEatl+E8BJnmT2\r
+ Qkgg==\r
+X-Gm-Message-State:\r
+ ALoCoQkEKlhggEDgZJ0rxiQ0xjtn7R1S1eTjtxoKRBZkcLLjbzzQhtRenNTq6hTt7looQfrtzgHM\r
+X-Received: by 10.181.11.229 with SMTP id el5mr19293647wid.43.1398761126167;\r
+ Tue, 29 Apr 2014 01:45:26 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+ by mx.google.com with ESMTPSA id\r
+ lj15sm3591239wic.13.2014.04.29.01.45.24 for <multiple recipients>\r
+ (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+ Tue, 29 Apr 2014 01:45:24 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: allow functions in\r
+ notmuch-show-stash-mlarchive-link-alist\r
+Date: Tue, 29 Apr 2014 10:45:30 +0200\r
+Message-Id: <1398761130-26865-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+Cc: Carl Worth <carl.d.worth@intel.com>\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: Tue, 29 Apr 2014 08:45:34 -0000\r
+\r
+Some archives may use a more complicated scheme for referring to\r
+messages than just concatenated url and message-id. In particular,\r
+patchwork requires a query to translate message-id to a patchwork\r
+patch id. Allow functions in notmuch-show-stash-mlarchive-link-alist\r
+to facilitate this.\r
+\r
+For example, one could use something like this for patchwork.\r
+\r
+(lambda (message-id)\r
+ (concat\r
+ "http://patchwork.example.com/patch/"\r
+ (nth 0\r
+ (split-string\r
+ (car (last (process-lines "pwclient" "search" "-n" "1"\r
+ "-m" (concat "<" message-id ">"))))))))\r
+---\r
+ emacs/notmuch-show.el | 27 ++++++++++++++++-----------\r
+ 1 files changed, 16 insertions(+), 11 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index df10d4b..b8bdbb9 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -183,7 +183,9 @@ each attachment handler is logged in buffers with names beginning\r
+ These URIs are concatenated with the current message's\r
+ Message-Id in `notmuch-show-stash-mlarchive-link'."\r
+ :type '(alist :key-type (string :tag "Name")\r
+- :value-type (string :tag "URL"))\r
++ :value-type (choice\r
++ (string :tag "URL")\r
++ (function :tag "Function returning the URL")))\r
+ :group 'notmuch-show)\r
+ \r
+ (defcustom notmuch-show-stash-mlarchive-link-default "Gmane"\r
+@@ -2055,16 +2057,19 @@ This presumes that the message is available at the selected Mailing List Archive\r
+ If optional argument MLA is non-nil, use the provided key instead of prompting\r
+ the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
+ (interactive)\r
+- (notmuch-common-do-stash\r
+- (concat (cdr (assoc\r
+- (or mla\r
+- (let ((completion-ignore-case t))\r
+- (completing-read\r
+- "Mailing List Archive: "\r
+- notmuch-show-stash-mlarchive-link-alist\r
+- nil t nil nil notmuch-show-stash-mlarchive-link-default)))\r
+- notmuch-show-stash-mlarchive-link-alist))\r
+- (notmuch-show-get-message-id t))))\r
++ (let ((url\r
++ (cdr (assoc\r
++ (or mla\r
++ (let ((completion-ignore-case t))\r
++ (completing-read\r
++ "Mailing List Archive: "\r
++ notmuch-show-stash-mlarchive-link-alist\r
++ nil t nil nil notmuch-show-stash-mlarchive-link-default)))\r
++ notmuch-show-stash-mlarchive-link-alist))))\r
++ (notmuch-common-do-stash\r
++ (if (functionp url)\r
++ (funcall url (notmuch-show-get-message-id t))\r
++ (concat url (notmuch-show-get-message-id t))))))\r
+ \r
+ (defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)\r
+ "Copy an ML Archive URI for the current message to the kill-ring and visit it.\r
+-- \r
+1.7.2.5\r
+\r