--- /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 1F1C9431FCB\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 13:35:45 -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 tIXotaarvcBT for <notmuch@notmuchmail.org>;\r
+ Thu, 30 Oct 2014 13:35:39 -0700 (PDT)\r
+Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com\r
+ [74.125.82.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ DBA77431FC2 for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 13:35:38 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f48.google.com with SMTP id m15so5127382wgh.21\r
+ for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 13:35:37 -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:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=bW0PymZt6Mtyw5J9fLDd5anGiM1YHgaWpHo/znUmWWw=;\r
+ b=jfvryi7Qr8gZTRnznmJKbIIwf12CDIluBxN0Hlb1W8A364So9tOFvDmR7DKUkcbVb1\r
+ OWCXyGsCGEv9bZphuD61+JzyJX56UV49IJtzWAJ2hLh45wfUP1X3GeFISfz8InINbWlv\r
+ iCC5dI0HpX7s2dZc6LZcldsbZoUKHU1/2HzgTs7BJak0TYcSvWvie29PTOl9ej0wLZPZ\r
+ VEmg7Agj/tIpzBV4Se1bLvp91SrQsRsumh+siabVAIiAI5DiwIagTl+ABe0g/iv7XQI9\r
+ z1ufolLdK6+97a1Po6e1jBTabQ3SwGk5wi83UNG6PovLsEm922wO4doDhUs0Fuu6xm6b\r
+ KpqQ==\r
+X-Gm-Message-State:\r
+ ALoCoQkBcJlozK5vIu4CmmCYXYClCOqPah1d/AfH01hzT2K+BKTRstBHfUu8Pyy+BoZmYEB60c+M\r
+X-Received: by 10.194.192.73 with SMTP id he9mr5240852wjc.125.1414701337475;\r
+ Thu, 30 Oct 2014 13:35:37 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c36d-48.dhcp.inet.fi.\r
+ [88.195.109.48])\r
+ by mx.google.com with ESMTPSA id ws2sm9871831wjc.32.2014.10.30.13.35.36\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Thu, 30 Oct 2014 13:35:36 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v1] emacs: Improved header display.\r
+In-Reply-To: <1414692196-12550-1-git-send-email-dme@dme.org>\r
+References: <1414692196-12550-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.18.2+152~g6e84b62 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Thu, 30 Oct 2014 22:35:34 +0200\r
+Message-ID: <874mul8fe1.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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 20:35:45 -0000\r
+\r
+On Thu, 30 Oct 2014, David Edmondson <dme@dme.org> wrote:\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
+Thanks for your efforts, David - I hate it that I'm going to sound\r
+ungrateful since I asked for something like this. But not quite like\r
+this...\r
+\r
+I think more header lines than just one should be displayed untruncated\r
+by default. I think it's okay to show, say, five lines of To: or Cc: and\r
+that'll probably cover most emails without truncation. And when the\r
+header does get truncated, I'd really like to see the indication more\r
+predominantly displayed than just ellipsis.\r
+\r
+I'm thinking of something like this, similar to notmuch-wash:\r
+\r
+---\r
+To: user@example.com, user@example.com, user@example.com,\r
+user@example.com, user@example.com, user@example.com, user@example.com,\r
+user@example.com, user@example.com, user@example.com, user@example.com,\r
+user@example.com, user@example.com, user@example.com, user@example.com,\r
+[ 42 more header lines. Click/Enter to show. ]\r
+Cc: user@example.com\r
+---\r
+\r
+BR,\r
+Jani.\r
+\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r