Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility
authorPieter Praet <pieter@praet.org>
Thu, 26 Jan 2012 13:02:15 +0000 (14:02 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:20 +0000 (09:43 -0800)
69/3b44d0d5d7d5e92e12b7b81db0eeab306bf382 [new file with mode: 0644]

diff --git a/69/3b44d0d5d7d5e92e12b7b81db0eeab306bf382 b/69/3b44d0d5d7d5e92e12b7b81db0eeab306bf382
new file mode 100644 (file)
index 0000000..64126e9
--- /dev/null
@@ -0,0 +1,144 @@
+Return-Path: <pieter@praet.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 479BA431FAF\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 05:04:15 -0800 (PST)\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 tHAHjek6Ofto for <notmuch@notmuchmail.org>;\r
+       Thu, 26 Jan 2012 05:04:14 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D0636431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 05:04:13 -0800 (PST)\r
+Received: by wibhi8 with SMTP id hi8so402874wib.26\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 05:04:11 -0800 (PST)\r
+Received: by 10.180.87.8 with SMTP id t8mr3990787wiz.15.1327583051377;\r
+       Thu, 26 Jan 2012 05:04:11 -0800 (PST)\r
+Received: from localhost ([109.131.116.159])\r
+       by mx.google.com with ESMTPS id cb8sm5340165wib.0.2012.01.26.05.04.10\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 26 Jan 2012 05:04:10 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: David Edmondson <dme@dme.org>, Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle\r
+       visibility\r
+In-Reply-To: <cunhazknvbe.fsf@hotblack-desiato.hh.sledj.net>\r
+References: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
+       <cunhazknvbe.fsf@hotblack-desiato.hh.sledj.net>\r
+User-Agent: Notmuch/0.11+132~ga81001f (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+Date: Thu, 26 Jan 2012 14:02:15 +0100\r
+Message-ID: <87vcnyvcq0.fsf@praet.org>\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: Thu, 26 Jan 2012 13:04:15 -0000\r
+\r
+On Wed, 25 Jan 2012 06:35:33 +0000, David Edmondson <dme@dme.org> wrote:\r
+> On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <pieter@praet.org> wrote:\r
+> > * emacs/notmuch-show.el (notmuch-show-open-or-close-all):\r
+> >   Rename to `notmuch-show-toggle-all-messages', and make it toggle\r
+> >   visibility of all messages based on the visibility of the current\r
+> >   message, instead of setting visibility based on whether or not a\r
+> >   prefix arg was supplied.\r
+> > \r
+> > Same functionality, less effort (reaching for 'C-u' is a pain)...\r
+> \r
+> -1.\r
+> \r
+> The behaviour you've provided is not what I want, from two perspectives:\r
+>         - currently it's clear what will happen when I use M-RET or\r
+>           C-uM-RET without me having to think about whether the cursor\r
+>           is over an open message,\r
+>         - often I'll be reading an open message and I want to open all\r
+>           of the rest to look at some context. That's a little more\r
+>           awkward after this change.\r
+\r
+I may be missing something, but wouldn't both issues be solved by simply\r
+pressing M-RET a second time?  I've been using this for a little while\r
+now, and IMO it makes navigating through long and diverging threads a lot\r
+faster, much like zooming in/out on an outline.\r
+\r
+How about if C-u M-RET behaved as usual ?\r
+\r
+\r
+> > \r
+> > ---\r
+> >  emacs/notmuch-show.el |   22 ++++++++++++----------\r
+> >  1 files changed, 12 insertions(+), 10 deletions(-)\r
+> > \r
+> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> > index e6a5b31..2d17f74 100644\r
+> > --- a/emacs/notmuch-show.el\r
+> > +++ b/emacs/notmuch-show.el\r
+> > @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
+> >    (define-key map "p" 'notmuch-show-previous-open-message)\r
+> >    (define-key map (kbd "DEL") 'notmuch-show-rewind)\r
+> >    (define-key map " " 'notmuch-show-advance-and-archive)\r
+> > -  (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
+> >    (define-key map (kbd "RET") 'notmuch-show-toggle-message)\r
+> > +  (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)\r
+> >    (define-key map "#" 'notmuch-show-print-message)\r
+> >    map)\r
+> >        "Keymap for \"notmuch show\" buffers.")\r
+> > @@ -1502,16 +1502,18 @@ the result."\r
+> >       (not (plist-get props :message-visible))))\r
+> >    (force-window-update))\r
+> >  \r
+> > -(defun notmuch-show-open-or-close-all ()\r
+> > -  "Set the visibility all of the messages in the current thread.\r
+> > -By default make all of the messages visible. With a prefix\r
+> > -argument, hide all of the messages."\r
+> > +(defun notmuch-show-toggle-all-messages ()\r
+> > +  "Toggle the visibility of all messages in the current thread.\r
+> > +If the current message is visible, hide all messages -- and vice versa."\r
+> >    (interactive)\r
+> > -  (save-excursion\r
+> > -    (goto-char (point-min))\r
+> > -    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
+> > -                                     (not current-prefix-arg))\r
+> > -    until (not (notmuch-show-goto-message-next))))\r
+> > +  (let ((toggle (notmuch-show-message-visible-p)))\r
+> > +    (save-excursion\r
+> > +      (goto-char (point-min))\r
+> > +      (loop do (notmuch-show-message-visible\r
+> > +          (notmuch-show-get-message-properties)\r
+> > +          (not toggle))\r
+> > +      until (not (notmuch-show-goto-message-next)))))\r
+> > +  (recenter-top-bottom 1)\r
+> >    (force-window-update))\r
+> >  \r
+> >  (defun notmuch-show-next-button ()\r
+> > -- \r
+> > 1.7.8.1\r
+> > \r
+> > _______________________________________________\r
+> > notmuch mailing list\r
+> > notmuch@notmuchmail.org\r
+> > http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+\r
+Peace\r
+\r
+-- \r
+Pieter\r