From 7dce0f1dc94c77a45ea2f06049fa019bcb816738 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 29 Apr 2014 10:45:30 +0200 Subject: [PATCH] [PATCH] emacs: allow functions in notmuch-show-stash-mlarchive-link-alist --- 1d/656cdb0f87355d6b485aec13eb53d9688be83f | 131 ++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 1d/656cdb0f87355d6b485aec13eb53d9688be83f diff --git a/1d/656cdb0f87355d6b485aec13eb53d9688be83f b/1d/656cdb0f87355d6b485aec13eb53d9688be83f new file mode 100644 index 000000000..60b79d9ac --- /dev/null +++ b/1d/656cdb0f87355d6b485aec13eb53d9688be83f @@ -0,0 +1,131 @@ +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 97D36431FBF + for ; Tue, 29 Apr 2014 01:45:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 mbQeX2aehBcW for ; + Tue, 29 Apr 2014 01:45:29 -0700 (PDT) +Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com + [74.125.82.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + A478F431FBD for ; Tue, 29 Apr 2014 01:45:29 -0700 + (PDT) +Received: by mail-wg0-f42.google.com with SMTP id k14so4756170wgh.1 + for ; Tue, 29 Apr 2014 01:45:27 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=Gxa/5jxSAQO6JQchZRVM5nQhHJGvBk0B4sb9mzOy4Do=; + b=lC+d5FW7X6tQLDvWJkOw0OAg2lRFbbX0g9JAkaRnfKnh9ZFJ+44GjIUvEMcqFSZO/R + Qv7jMcjV+QlOWUIUYhExyxV71ONrkhkBKvCpRM0BqLCsTBQe5Vep3dJIhFpT4b4Bl0C6 + zDcmfC3SxPThr5LcavXmEQsgoPMUd/W1uUBmF+RdzrHZhI6zIJrthjB9bmRS4j3FhLl6 + HZXqnc/me9Iw4sBpZun9BRw5M+ATi15xic9zir6KKmg5ysW6HEstyZeaDWeOYq9JY0GA + cYuArNJNvyKBMZVAGRM0FmCSMjw4jXbfpElq6qRL8MEejF9Rc7pTvTDEatl+E8BJnmT2 + Qkgg== +X-Gm-Message-State: + ALoCoQkEKlhggEDgZJ0rxiQ0xjtn7R1S1eTjtxoKRBZkcLLjbzzQhtRenNTq6hTt7looQfrtzgHM +X-Received: by 10.181.11.229 with SMTP id el5mr19293647wid.43.1398761126167; + Tue, 29 Apr 2014 01:45:26 -0700 (PDT) +Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) + by mx.google.com with ESMTPSA id + lj15sm3591239wic.13.2014.04.29.01.45.24 for + (version=TLSv1.1 cipher=RC4-SHA bits=128/128); + Tue, 29 Apr 2014 01:45:24 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: allow functions in + notmuch-show-stash-mlarchive-link-alist +Date: Tue, 29 Apr 2014 10:45:30 +0200 +Message-Id: <1398761130-26865-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.7.2.5 +Cc: Carl Worth +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: Tue, 29 Apr 2014 08:45:34 -0000 + +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 ">")))))))) +--- + emacs/notmuch-show.el | 27 ++++++++++++++++----------- + 1 files changed, 16 insertions(+), 11 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index df10d4b..b8bdbb9 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -183,7 +183,9 @@ each attachment handler is logged in buffers with names beginning + These URIs are concatenated with the current message's + Message-Id in `notmuch-show-stash-mlarchive-link'." + :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 +2057,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. +-- +1.7.2.5 + -- 2.26.2