Re: [PATCH] Emacs: Add variable to toggle message indentation in a thread
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 11 Jul 2011 09:55:24 +0000 (13:55 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:04 +0000 (09:39 -0800)
28/4d9b2d1bf3debc019c51418f5e8bf417f1a1ae [new file with mode: 0644]

diff --git a/28/4d9b2d1bf3debc019c51418f5e8bf417f1a1ae b/28/4d9b2d1bf3debc019c51418f5e8bf417f1a1ae
new file mode 100644 (file)
index 0000000..47f5192
--- /dev/null
@@ -0,0 +1,212 @@
+Return-Path: <dmitry.kurochkin@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 A72C0431FD0\r
+       for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 02:55:32 -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 0KTfNzilJupv for <notmuch@notmuchmail.org>;\r
+       Mon, 11 Jul 2011 02:55:31 -0700 (PDT)\r
+Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 79CBA431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 02:55:31 -0700 (PDT)\r
+Received: by bwg12 with SMTP id 12so3551413bwg.26\r
+       for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 02:55:30 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=tubY19e63EfhvECg+QrXzSWfM1SkRwSX55FfwfdGbRc=;\r
+       b=b7QMF4Ag8Vvep0+AXqDQROWyiEbURgHu8+uMY3Rog492/BxNo5D301is9JP0nW1OGy\r
+       Ke9vQzwNcVLqKYHUJmZ9dQv00d825/W+K2/23SNpqoxInyGlALIXWocgk2K5MZqJrcEj\r
+       xbo1U58Yms10WsAf3II0RHwmkTnRP+pUbr0Ew=\r
+Received: by 10.204.144.194 with SMTP id a2mr2467472bkv.93.1310378130098;\r
+       Mon, 11 Jul 2011 02:55:30 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id o3sm976584bka.33.2011.07.11.02.55.28\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 11 Jul 2011 02:55:29 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Felix Geller <fgeller@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] Emacs: Add variable to toggle message indentation in a\r
+       thread\r
+In-Reply-To: <m2aaclkw46.fsf@gmail.com>\r
+References: <m2r55xi4yr.fsf@gmail.com> <87mxgl19n3.fsf@gmail.com>\r
+       <m2aaclkw46.fsf@gmail.com>\r
+User-Agent: Notmuch/0.5-321-g41686e2 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 11 Jul 2011 13:55:24 +0400\r
+Message-ID: <877h7p16r7.fsf@gmail.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: Mon, 11 Jul 2011 09:55:32 -0000\r
+\r
+On Mon, 11 Jul 2011 11:24:57 +0200, Felix Geller <fgeller@gmail.com> wrote:\r
+> Hi Dmitry,\r
+> \r
+> thank you for the comments. I included an updated patch that also\r
+> includes Daniel's comment regarding the default value. \r
+> \r
+\r
+Another thing that would be nice to have is a test for this feature.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+> I didn't change the "when" though--not because of personal reasons\r
+> ;)--but because it is used for determining indentation of multi-parts.\r
+> \r
+> \r
+> Cheers,\r
+> Felix\r
+> \r
+> \r
+> \r
+> On Mon, 11 Jul 2011 12:53:04 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
+> > Hi Felix.\r
+> > \r
+> > On Mon, 11 Jul 2011 10:42:04 +0200, Felix Geller <fgeller@gmail.com> wrote:\r
+> > > Hi,\r
+> > > \r
+> > > I added a variable to toggle message indentation in Emacs.\r
+> > > \r
+> > > Please let me know what you think.\r
+> > > \r
+> > \r
+> > I like the change.  Though I do not think I would use it without\r
+> > chronological sorting.\r
+> > \r
+> > Comments on the code below.\r
+> > \r
+> > Regards,\r
+> >   Dmitry\r
+> > \r
+> > > \r
+> > > Cheers,\r
+> > > Felix\r
+> > > \r
+> > > \r
+> > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> > > index a433dec..8101c27 100644\r
+> > > --- a/emacs/notmuch-show.el\r
+> > > +++ b/emacs/notmuch-show.el\r
+> > > @@ -90,6 +90,11 @@ any given message."\r
+> > >    :group 'notmuch\r
+> > >    :type 'boolean)\r
+> > >  \r
+> > > +(defcustom notmuch-show-indent-messages-in-thread nil\r
+> > > +  "Should the messages in a thread be indented according to their respective depth in the thread?"\r
+> > \r
+> > This line is too long and should be split.\r
+> > \r
+> > > +  :group 'notmuch\r
+> > > +  :type 'boolean)\r
+> > > +\r
+> > >  (defcustom notmuch-show-indent-multipart nil\r
+> > >    "Should the sub-parts of a multipart/* part be indented?"\r
+> > >    ;; dme: Not sure which is a good default.\r
+> > > @@ -237,7 +242,9 @@ unchanged ADDRESS if parsing fails."\r
+> > >    "Insert a notmuch style headerline based on HEADERS for a\r
+> > >  message at DEPTH in the current thread."\r
+> > >    (let ((start (point)))\r
+> > > -    (insert (notmuch-show-spaces-n depth)\r
+> > > +    (insert (if notmuch-show-indent-messages-in-thread\r
+> > > +                (notmuch-show-spaces-n depth)\r
+> > > +              "")\r
+> > \r
+> > (if notmuch-show-indent-messages-in-thread\r
+> >     (insert (notmuch-show-spaces-n depth)))\r
+> > \r
+> > Is cleaner and avoids useless empty string insert.\r
+> > \r
+> > >              (notmuch-show-clean-address (plist-get headers :From))\r
+> > >              " ("\r
+> > >              date\r
+> > > @@ -733,7 +740,8 @@ current buffer, if possible."\r
+> > >      (setq content-end (point-marker))\r
+> > >  \r
+> > >      ;; Indent according to the depth in the thread.\r
+> > > -    (indent-rigidly content-start content-end depth)\r
+> > > +    (when notmuch-show-indent-messages-in-thread\r
+> > > +      (indent-rigidly content-start content-end depth))\r
+> > \r
+> > Not a big deal, but I would prefer `if' instead of `when' here.\r
+> > \r
+> > Regards,\r
+> >   Dmitry\r
+> > \r
+> > >  \r
+> > >      (setq message-end (point-max-marker))\r
+> > >  \r
+> > > _______________________________________________\r
+> > > notmuch mailing list\r
+> > > notmuch@notmuchmail.org\r
+> > > http://notmuchmail.org/mailman/listinfo/notmuch\r
+> \r
+> \r
+> commit f90fafdc0545a825ea4b69db5e51c2e866a4ff5e\r
+> Author: Felix Geller <fgeller@gmail.com>\r
+> Date:   Mon Jul 11 10:39:00 2011 +0200\r
+> \r
+>     Added a variable to toggle message indentation for thread view in emacs.\r
+>      - includes adjustments according to comments from ML\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index a433dec..1834066 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -90,6 +90,11 @@ any given message."\r
+>    :group 'notmuch\r
+>    :type 'boolean)\r
+>  \r
+> +(defcustom notmuch-show-indent-messages-in-thread t\r
+> +  "Should messages be indented according to their depth in a thread?"\r
+> +  :group 'notmuch\r
+> +  :type 'boolean)\r
+> +\r
+>  (defcustom notmuch-show-indent-multipart nil\r
+>    "Should the sub-parts of a multipart/* part be indented?"\r
+>    ;; dme: Not sure which is a good default.\r
+> @@ -237,8 +242,9 @@ unchanged ADDRESS if parsing fails."\r
+>    "Insert a notmuch style headerline based on HEADERS for a\r
+>  message at DEPTH in the current thread."\r
+>    (let ((start (point)))\r
+> -    (insert (notmuch-show-spaces-n depth)\r
+> -        (notmuch-show-clean-address (plist-get headers :From))\r
+> +    (when notmuch-show-indent-messages-in-thread\r
+> +      (insert (notmuch-show-spaces-n depth)))\r
+> +    (insert (notmuch-show-clean-address (plist-get headers :From))\r
+>          " ("\r
+>          date\r
+>          ") ("\r
+> @@ -733,7 +739,8 @@ current buffer, if possible."\r
+>      (setq content-end (point-marker))\r
+>  \r
+>      ;; Indent according to the depth in the thread.\r
+> -    (indent-rigidly content-start content-end depth)\r
+> +    (when notmuch-show-indent-messages-in-thread\r
+> +      (indent-rigidly content-start content-end depth))\r
+>  \r
+>      (setq message-end (point-max-marker))\r
+>  \r