[RFC PATCH] emacs: show: make show-get-message-prop usable from pick
authorMark Walters <markwalters1009@gmail.com>
Sun, 2 Dec 2012 21:29:04 +0000 (21:29 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:21 +0000 (09:51 -0800)
97/4e168a31ae68fc1da60fe98a8bcea541823f70 [new file with mode: 0644]

diff --git a/97/4e168a31ae68fc1da60fe98a8bcea541823f70 b/97/4e168a31ae68fc1da60fe98a8bcea541823f70
new file mode 100644 (file)
index 0000000..4f233a8
--- /dev/null
@@ -0,0 +1,114 @@
+Return-Path: <markwalters1009@gmail.com>\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 0014F431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Dec 2012 13:29:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       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 GJ7fFLtFveeB for <notmuch@notmuchmail.org>;\r
+       Sun,  2 Dec 2012 13:29:09 -0800 (PST)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 60BA6431FAE\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Dec 2012 13:29:09 -0800 (PST)\r
+Received: by mail-we0-f181.google.com with SMTP id t11so1042712wey.26\r
+       for <notmuch@notmuchmail.org>; Sun, 02 Dec 2012 13:29:08 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=30BgykevuL32lyltuVomXx+LXtjE+eMSXP5aHfvR0PA=;\r
+       b=dOg57CoBpSSP+D9SMRQKHkvHEv7hRwouipFv1r5mMIYcJMOTLpWz17ikhtCjAQe82/\r
+       R54Lm9YUXx0oFj/gW1TzMQEDTGq+rFA8YF5TJle0ZP2JR8YidmuxsIHdAjTJi/VMMguJ\r
+       J4MVZ7loKeHWaQN1P9UY4Zd8LtVGXlZRB/4q3s6HPMosOY7GiOueZGbKPGVFqH4DarCE\r
+       NddpOL8B5Zut7kZ2xAwy7vbuN/a7TC09LOIkzIA/HRutY4wP3cyrnSUcbcED6KopwP0S\r
+       PSNbPF4bsrbzUldUfii1ZMorONJNUeHoRKLKD9WoN4gD8FQSKWVFJ/AmbP+UG2c51r1t\r
+       9Ijw==\r
+Received: by 10.216.24.212 with SMTP id x62mr2440921wex.204.1354483747864;\r
+       Sun, 02 Dec 2012 13:29:07 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPS id w5sm9677863wiz.10.2012.12.02.13.29.06\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 02 Dec 2012 13:29:06 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH] emacs: show: make show-get-message-prop usable from pick\r
+Date: Sun,  2 Dec 2012 21:29:04 +0000\r
+Message-Id: <1354483744-27541-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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: Sun, 02 Dec 2012 21:29:10 -0000\r
+\r
+Make notmuch-show-get-prop choose the get-message-properties routine\r
+based on the major mode. This make it usable from notmuch-pick and\r
+thus a large number of functions are usable directly from\r
+notmuch-show.el and do not need to be reimplemented in pick.\r
+---\r
+\r
+With this change (and a corresponding very small change in pick) I can\r
+use a large number of functions straight from show in pick-mode. The\r
+only change they need is that when they get a message property (most\r
+commonly the message-id) they use the correct routine. This makes the\r
+choice of the routine based on the major-mode.\r
+\r
+It seems to work and could save quite a lot of code being essentially\r
+duplicated. Would something like this be acceptable? Would it be way\r
+too slow? Is there some much better way? Any comments (including "Just\r
+don't do that") gratefully received.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+ emacs/notmuch-show.el |    7 ++++++-\r
+ 1 files changed, 6 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 4d6c014..3e68871 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1378,6 +1378,10 @@ Some useful entries are:\r
+     (notmuch-show-move-to-message-top)\r
+     (get-text-property (point) :notmuch-message-properties)))\r
\r
++(defun notmuch-show-mode-get-message-properties ()\r
++  "Wrapper for notmuch-show-get-message-properties"\r
++  (notmuch-show-get-message-properties))\r
++\r
+ (defun notmuch-show-set-prop (prop val &optional props)\r
+   (let ((inhibit-read-only t)\r
+       (props (or props\r
+@@ -1387,7 +1391,8 @@ Some useful entries are:\r
\r
+ (defun notmuch-show-get-prop (prop &optional props)\r
+   (let ((props (or props\r
+-                 (notmuch-show-get-message-properties))))\r
++                 (funcall (intern (concat (symbol-name major-mode)\r
++                                          "-get-message-properties"))))))\r
+     (plist-get props prop)))\r
\r
+ (defun notmuch-show-get-message-id (&optional bare)\r
+-- \r
+1.7.9.1\r
+\r