Re: [PATCH v2] emacs: Add more processing of displayed headers.
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Fri, 12 Oct 2012 19:11:11 +0000 (15:11 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:45 +0000 (09:49 -0800)
21/3450f23aa731c225f7cad48ab4ec5cb2258758 [new file with mode: 0644]

diff --git a/21/3450f23aa731c225f7cad48ab4ec5cb2258758 b/21/3450f23aa731c225f7cad48ab4ec5cb2258758
new file mode 100644 (file)
index 0000000..5bf7cb3
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <ethan.glasser.camp@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 04D23431FAF\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Oct 2012 12:11:20 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 EboCTzC+IYpy for <notmuch@notmuchmail.org>;\r
+       Fri, 12 Oct 2012 12:11:19 -0700 (PDT)\r
+Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com\r
+       [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0B73B431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Oct 2012 12:11:19 -0700 (PDT)\r
+Received: by mail-qa0-f46.google.com with SMTP id c26so119914qad.5\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Oct 2012 12:11:18 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=zM85p8sqM76LqthFEbl7VYW70ls6RWsaKz8w+UhZvr4=;\r
+       b=Sf2wH0NvIq6spO65oidsnl5PIKfauAQdlWo5KiO8G9qly3Wtw8qKTXKzkfd3nu6uvF\r
+       5QKHfvoYGO3wVUOspLQKhy1M+l2buZmenoygbPIog0bIKxPOvSsJ0lh9x4LbwdV1H3Ga\r
+       koelEhiFCD8uLQr7yj4nElXETrSHZ/d5+ocWKvLmYIF4v0fikA5MQuR99bPvMZhB8Xtf\r
+       8Yf0RvL+Tzs95d9WXEWK9K1kPM1852zdPq7qYvMQQ/HMh+rY8seIh7TnVgBWD/lxcOkt\r
+       Fwhz/ZH0bS5mhfsS6nxS4CJv3HqTlntDL5PzZedExt+842Cz/gwnnQnXRa/64+Egt4tu\r
+       lXGA==\r
+Received: by 10.224.222.13 with SMTP id ie13mr8911903qab.69.1350069078538;\r
+       Fri, 12 Oct 2012 12:11:18 -0700 (PDT)\r
+Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])\r
+       by mx.google.com with ESMTPS id g4sm7946225qav.16.2012.10.12.12.11.16\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 12 Oct 2012 12:11:16 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: Add more processing of displayed headers.\r
+In-Reply-To: <1328542748-19530-2-git-send-email-dme@dme.org>\r
+References: <1327052612-1040-1-git-send-email-dme@dme.org>\r
+       <1328542748-19530-1-git-send-email-dme@dme.org>\r
+       <1328542748-19530-2-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 12 Oct 2012 15:11:11 -0400\r
+Message-ID: <87sj9ja4kw.fsf@betacantrips.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Fri, 12 Oct 2012 19:11:20 -0000\r
+\r
+Hi! Just going through the patch queue.\r
+\r
+This is definitely a nice effect, but I'm not sure of the approach. It\r
+doesn't indent the message's tags, and it doesn't work when you resize the\r
+window. (You can get some very ugly wrapping if you put your mind to\r
+it.)\r
+\r
+Is there no better way to do this using visual-line-mode? I know that\r
+the rest of notmuch uses hard filling, but that's no reason to make a\r
+bad situation worse. It looks like you can put wrap-prefix text\r
+properties all over, as done in the adaptive-wrap package:\r
+\r
+http://elpa.gnu.org/packages/adaptive-wrap-0.1.el\r
+\r
+Slightly more nit-picky comments below.\r
+\r
+David Edmondson <dme@dme.org> writes:\r
+\r
+> -(defvar notmuch-show-markup-headers-hook '(notmuch-show-colour-headers)\r
+> +(defcustom notmuch-show-markup-headers-hook '(notmuch-show-colour-headers\r
+> +                                          notmuch-show-fill-headers\r
+> +                                          notmuch-show-indent-continuations)\r
+>    "A list of functions called to decorate the headers listed in\r
+> -`notmuch-message-headers'.")\r
+> +`notmuch-message-headers'."\r
+> +  :type 'hook\r
+> +  :options '(notmuch-show-colour-headers\r
+> +         notmuch-show-fill-headers\r
+> +         notmuch-show-indent-continuations)\r
+> +  :group 'notmuch-show)\r
+\r
+This hook is not normal because it takes an argument, and so should have\r
+a name ending in -hooks or -functions. Also, since it's a defcustom now,\r
+it should probably have a better explanation of how it works, that it\r
+takes an argument, and what that argument means.\r
+\r
+It seems extremely dicey to me that you can put\r
+notmuch-show-indent-continuations in this list before, or without,\r
+notmuch-show-fill-headers.\r
+\r
+> +(defun notmuch-show-fill-headers (depth)\r
+> +  "Wrap the text of the current headers."\r
+> +\r
+> +  ;; '-5' to allow for the indentation code.\r
+> +  (let ((fill-column (- (window-width) depth 5)))\r
+\r
+It took me a little while to figure out what this meant. How about,\r
+"underfill by 5 so that inserting indentation doesn't cause more\r
+wrapping"? Is it possible to be smart enough to let\r
+\r
+> +(defun notmuch-show-indent-continuations (depth)\r
+> +  "Indent any continuation lines."\r
+> +  (goto-char (point-min))\r
+> +  (while (not (eobp))\r
+> +    (if (not (looking-at "^[A-Za-z][-A-Za-z0-9]*:"))\r
+> +    ;; Four spaces tends to work well with 'To' and 'Cc' headers.\r
+> +    (insert "    "))\r
+> +    (forward-line)))\r
+\r
+I'm not crazy about this but I'm not sure I can say why exactly. Why\r
+can't we just run indent-rigidly over the whole thing?\r
+\r
+The comment isn't terribly useful. Only those headers? "Tends to work\r
+well"?\r
+\r
+>      ;; Override `notmuch-message-headers' to force `From' to be\r
+>      ;; displayed.\r
+>      (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date")))\r
+> -      (notmuch-show-insert-headers (plist-get message :headers)))\r
+> +      (notmuch-show-insert-headers (plist-get message :headers) 0))\r
+\r
+This took me a long while to figure out, especially because it looks\r
+like the depth is being passed normally to notmuch-show-insert-bodypart,\r
+just below. A comment like "depth = 0 because we reindent below" would\r
+have been really helpful. A good test message is\r
+id:"87ocabvp0y.fsf@wsheee.2x.cz".\r
+\r
+Ethan\r