From: Mark Walters Date: Mon, 2 Sep 2013 03:28:08 +0000 (+0100) Subject: [PATCH 4/4] contrib: pick: make the tree graphics a proper part of the format X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a150a6d65c3a7f87ee959c2a30d536da2f1433ad;p=notmuch-archives.git [PATCH 4/4] contrib: pick: make the tree graphics a proper part of the format --- diff --git a/17/d2217ee4711456ff406f33b5a4f3d2b0d977cc b/17/d2217ee4711456ff406f33b5a4f3d2b0d977cc new file mode 100644 index 000000000..4a7dae949 --- /dev/null +++ b/17/d2217ee4711456ff406f33b5a4f3d2b0d977cc @@ -0,0 +1,164 @@ +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 93C85431E84 + for ; Sun, 1 Sep 2013 20:28:30 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 aSvlumhdL0GP for ; + Sun, 1 Sep 2013 20:28:26 -0700 (PDT) +Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + EF5C6431FCF for ; Sun, 1 Sep 2013 20:28:20 -0700 + (PDT) +Received: by mail-wg0-f45.google.com with SMTP id y10so2970398wgg.12 + for ; Sun, 01 Sep 2013 20:28:19 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=ATGrk/z0l0o5lEIv4agnE5v+/VCo6jghaU2R5MhZhjI=; + b=vu1UFR1WqDqOCE1x76eJMN/rYDehLr5kLcsw98DD/nkoQBci587434pN0VVyj3VWaB + qHbE9R/ayq5tlJm5SjpZtRjOSIAQYorpjLIa1DlIW9By8VNKMmtXLwGs3yGfZuzoK+63 + nmmt97u7Q94204LTM2L90EK6Om6CFMCD4pds9TNCSS/q6pc+1ZW4Zlt0RgNtdWlMDBC/ + 11XKSmEWgrXPTSpFonrFEbrXdrtxWs4Fc3iO0FWhlzdT4nmXtdUNeMpsU1Fq9/Uu/5B2 + VIIJgUUttFa+SvxnFzd4vFWspMHhARlq75b918WTii7URaHp2pcckoXlRp13pAj7BSeF + 5cgw== +X-Received: by 10.180.182.15 with SMTP id ea15mr11833510wic.16.1378092499917; + Sun, 01 Sep 2013 20:28:19 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id i3sm14853715wiw.7.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sun, 01 Sep 2013 20:28:19 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 4/4] contrib: pick: make the tree graphics a proper part of + the format +Date: Mon, 2 Sep 2013 04:28:08 +0100 +Message-Id: <1378092488-32050-5-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1378092488-32050-1-git-send-email-markwalters1009@gmail.com> +References: <1378092488-32050-1-git-send-email-markwalters1009@gmail.com> +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: Mon, 02 Sep 2013 03:28:30 -0000 + +Previously the box graphics in the pick view were always attached to +the subject. Make them a field in their own right. We use the +recursive insert to change the default notmuch-pick-result-format so +that the user view does not change. (The subject touches the tree box +graphics but the next column (tags) is still vertically aligned.) +--- + contrib/notmuch-pick/notmuch-pick.el | 49 +++++++++++++++++++++++++-------- + 1 files changed, 37 insertions(+), 12 deletions(-) + +diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el +index 5dfcef3..b6f7362 100644 +--- a/contrib/notmuch-pick/notmuch-pick.el ++++ b/contrib/notmuch-pick/notmuch-pick.el +@@ -65,13 +65,18 @@ + (defcustom notmuch-pick-result-format + `(("date" . "%12s ") + ("authors" . "%-20s") +- ("subject" . " %-54s ") ++ ((("tree" . "%s")("subject" . "%s")) ." %-54s ") + ("tags" . "(%s)")) + "Result formatting for Pick. Supported fields are: date, +- authors, subject, tags Note: subject includes the tree +- structure graphics, and the author string should not +- contain whitespace (put it in the neighbouring fields +- instead). For example: ++ authors, subject, tree, tags. Tree means the thread tree ++ box graphics. The field may also be a list in which case ++ the formatting rules are applied recursively and then the ++ output of all the fields in the list is inserted ++ according to format-string. ++ ++Note the author string should not contain ++ whitespace (put it in the neighbouring fields instead). ++ For example: + (setq notmuch-pick-result-format \(\(\"authors\" . \"%-40s\"\) + \(\"subject\" . \"%s\"\)\)\)" + :type '(alist :key-type (string) :value-type (string)) +@@ -108,6 +113,12 @@ + :group 'notmuch-pick + :group 'notmuch-faces) + ++(defface notmuch-pick-match-tree-face ++ '((t :inherit default)) ++ "Face used in pick mode for the thread tree block graphics in messages matching the query." ++ :group 'notmuch-pick ++ :group 'notmuch-faces) ++ + (defface notmuch-pick-match-tag-face + '((((class color) + (background dark)) +@@ -134,6 +145,12 @@ + :group 'notmuch-pick + :group 'notmuch-faces) + ++(defface notmuch-pick-no-match-tree-face ++ '((t (:foreground "gray"))) ++ "Face used in pick mode for the thread tree block graphics in messages matching the query." ++ :group 'notmuch-pick ++ :group 'notmuch-faces) ++ + (defface notmuch-pick-no-match-author-face + '((t (:foreground "gray"))) + "Face used in pick mode for the date in messages matching the query." +@@ -628,19 +645,27 @@ unchanged ADDRESS if parsing fails." + (propertize (format format-string (plist-get msg :date_relative)) + 'face face)))) + +- ((string-equal field "subject") ++ ((string-equal field "tree") + (let ((tree-status (plist-get msg :tree-status)) +- (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))) ++ (face (if match ++ 'notmuch-pick-match-tree-face ++ 'notmuch-pick-no-match-tree-face))) ++ ++ (setq formatted-field ++ (propertize (format format-string ++ (mapconcat #'identity (reverse tree-status) "")) ++ 'face face)))) ++ ++ ((string-equal field "subject") ++ (let ((bare-subject (notmuch-show-strip-re (plist-get headers :Subject))) + (face (if match + 'notmuch-pick-match-subject-face + 'notmuch-pick-no-match-subject-face))) + (setq formatted-field + (propertize (format format-string +- (concat +- (mapconcat #'identity (reverse tree-status) "") +- (if (string= notmuch-pick-previous-subject bare-subject) +- " ..." +- bare-subject))) ++ (if (string= notmuch-pick-previous-subject bare-subject) ++ " ..." ++ bare-subject)) + 'face face)) + (setq notmuch-pick-previous-subject bare-subject))) + +-- +1.7.9.1 +