--- /dev/null
+Return-Path: <dme@dme.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 9F4F9431FC2\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 11:03:25 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7, UNPARSEABLE_RELAY=0.001]\r
+ 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 P8MI7zUCVgVs for <notmuch@notmuchmail.org>;\r
+ Thu, 30 Oct 2014 11:03:20 -0700 (PDT)\r
+Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com\r
+ [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id AEE4E431FCB\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 11:03:20 -0700 (PDT)\r
+Received: by mail-wi0-f169.google.com with SMTP id n3so1855209wiv.4\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 11:03:18 -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:user-agent:from:to:subject:date:message-id;\r
+ bh=i3+w0Q4I4jLdsg9c5Zz7H7VaP//JDuMmenU7xX9fFzA=;\r
+ b=Lk1+oAudFEpwyKwuRfC8sAvxkKI8gyX2DRHXSK8zDZ9Ceey3KxSURAe6RYhZRHsASV\r
+ RF46u1uyV3bqnvZREu99qGcaVH58G8wYqbEcJ0C5SJtxmuNqAq/FQ3/3AFi1tVpSQwJw\r
+ +JGjT2r5+k28Zh/H2H2IJ1Y/O8padxDvc+yPokgYkHMunmwmjZ9qurSWs3fTh4OlcOL5\r
+ rSVrn6/+Mq2mzE8wgVDFTYH0zk7gXeRPuck6k17NTq6dcc4xOdIDu+Ek6oa+gCI6ooqh\r
+ RqGAY8VTA6/u5Cuw+BO8K7QYobI18XPT26M5G5Zxgfk2Nx+AwN30CGApQ/rlvC9qHiju\r
+ Yonw==\r
+X-Gm-Message-State:\r
+ ALoCoQma+A9kFWeDtjhFO+L4QRF0ECDTEl9kT4A24ExkgvfROJEPXfxEJreYmyGYx5f3rG7AJgnZ\r
+X-Received: by 10.181.8.98 with SMTP id dj2mr21658488wid.70.1414692198209;\r
+ Thu, 30 Oct 2014 11:03:18 -0700 (PDT)\r
+Received: from disaster-area.hh.sledj.net\r
+ ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+ by mx.google.com with ESMTPSA id s10sm3991183wix.14.2014.10.30.11.03.17\r
+ for <notmuch@notmuchmail.org>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Thu, 30 Oct 2014 11:03:17 -0700 (PDT)\r
+Received: from localhost (30000@localhost [local]);\r
+ by localhost (OpenSMTPD) with ESMTPA id fa989dfb;\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 18:03:16 +0000 (UTC)\r
+User-Agent: OpenSMTPD enqueuer (Demoostik)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v1] emacs: Improved header display.\r
+Date: Thu, 30 Oct 2014 18:03:16 +0000\r
+Message-Id: <1414692196-12550-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 2.1.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: Thu, 30 Oct 2014 18:03:25 -0000\r
+\r
+Truncate the displayed headers to the window width. Show an ellipsis\r
+if the displayed header is truncated. Add a binding 'T' to toggle the\r
+truncation of headers. Add the not-displayed section of the header as\r
+a tooltip to the displayed section.\r
+---\r
+ emacs/notmuch-show.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++++---\r
+ 1 file changed, 51 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index a997482..523cef5 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -443,9 +443,56 @@ message at DEPTH in the current thread."\r
+ ")\n")\r
+ (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))\r
+ \r
++(defun notmuch-truncate-nicely (addresses target-length)\r
++ ;; If it fits, everything is easy.\r
++ (if (< (length addresses) target-length)\r
++ (cons addresses nil)\r
++ (let* ((visible-length (- target-length (length "...")))\r
++ (visible (substring addresses 0 visible-length))\r
++ (invisible (substring addresses visible-length)))\r
++ ;; Try to terminate the visible string at a good break point.\r
++ (when (string-match "\\(.+\\),\\([^,]*\\)" visible)\r
++ ;; Order is important (second clause is destructive on\r
++ ;; `visible'.\r
++ (setq invisible (concat (match-string 2 visible) invisible)\r
++ visible (match-string 1 visible)))\r
++ ;; `invisible' can end up with a leading space or\r
++ ;; comma-space, because the list of addresses is\r
++ ;; seperated with ", ", but we split on ",".\r
++ (setq invisible (replace-regexp-in-string "^[, ]*\\(.*\\)$" "\\1" invisible))\r
++ (cons visible invisible))))\r
++\r
++(defun notmuch-show-toggle-header-truncation ()\r
++ (interactive)\r
++ (let ((invisibility-spec-member (cons 'notmuch-show-mode t)))\r
++ (if (member invisibility-spec-member buffer-invisibility-spec)\r
++ (remove-from-invisibility-spec invisibility-spec-member)\r
++ (add-to-invisibility-spec invisibility-spec-member)))\r
++ ;; Required to have the change in visibility take effect.\r
++ (force-window-update))\r
++\r
+ (defun notmuch-show-insert-header (header header-value)\r
+ "Insert a single header."\r
+- (insert header ": " (notmuch-sanitize header-value) "\n"))\r
++ (let* ((header-value (notmuch-sanitize header-value))\r
++ (header-colon (concat header ": "))\r
++ (available-width (- (window-width) (length header-colon)))\r
++ (v-i (notmuch-truncate-nicely header-value available-width)))\r
++\r
++ (insert header-colon)\r
++ (let ((visible (car v-i))\r
++ (invisible (cdr v-i)))\r
++ (when invisible\r
++ (setq visible (propertize visible 'help-echo (concat "..." invisible))))\r
++ (insert visible)\r
++ (when invisible\r
++ (insert ", ")\r
++ (let ((start (point))\r
++ overlay)\r
++ (insert invisible)\r
++ (setq overlay (make-overlay start (point)))\r
++ (overlay-put overlay 'invisible 'notmuch-show-mode)\r
++ (overlay-put overlay 'isearch-open-invisible #'delete-overlay))))\r
++ (insert "\n")))\r
+ \r
+ (defun notmuch-show-insert-headers (headers)\r
+ "Insert the headers of the current message."\r
+@@ -1328,6 +1375,7 @@ reset based on the original query."\r
+ (define-key map "$" 'notmuch-show-toggle-process-crypto)\r
+ (define-key map "<" 'notmuch-show-toggle-thread-indentation)\r
+ (define-key map "t" 'toggle-truncate-lines)\r
++ (define-key map "T" 'notmuch-show-toggle-header-truncation)\r
+ (define-key map "." 'notmuch-show-part-map)\r
+ map)\r
+ "Keymap for \"notmuch show\" buffers.")\r
+@@ -1367,8 +1415,8 @@ All currently available key bindings:\r
+ (use-local-map notmuch-show-mode-map)\r
+ (setq major-mode 'notmuch-show-mode\r
+ mode-name "notmuch-show")\r
+- (setq buffer-read-only t\r
+- truncate-lines t))\r
++ (add-to-invisibility-spec (cons 'notmuch-show-mode t))\r
++ (setq buffer-read-only t))\r
+ \r
+ (defun notmuch-tree-from-show-current-query ()\r
+ "Call notmuch tree with the current query"\r
+-- \r
+2.1.1\r
+\r