From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 42A96431FB6 for ; Tue, 19 Jun 2012 13:14:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Alx-zELtqPMD for ; Tue, 19 Jun 2012 13:14:54 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 744E8431FAF for ; Tue, 19 Jun 2012 13:14:54 -0700 (PDT) Received: by lbbgk8 with SMTP id gk8so6786557lbb.26 for ; Tue, 19 Jun 2012 13:14:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Rjfd322FkZCVE9MnR+g7+SZFA33ssiG23saK2d9TwsQ=; b=oIDKynQhmrPVpBmS7dYlA5rKZzGJGa0hLbY60GHPCEgdZhb4VxGUoN7XKbUqAjdsLC TPAYFxt9kSirAOmImrwnvf3ZYCwDIbKFkWHblv0IFB4H+ZMYX/UWkD2BuDfq0grobP5h 18HZ6U6CTVYIs9xBgJI2tM6ylKlvL59ypXYDZb13R3jB24H5Siib7NG8xlxI8DxCnL4u 5HMXDq3HwkIAnYrqfEse8HL7eI40AkCgot49PPgmCe0kJeurgSoHdBNKsRUDZpVEAXn6 dtBVTNv0g4uUi/avs9/mPumHYiXUYI55Rc2FW899n2iUW/SFvPr8K6Zt7mwlxX4kOZtL Jz8g== Received: by 10.152.146.67 with SMTP id ta3mr19641474lab.27.1340136892696; Tue, 19 Jun 2012 13:14:52 -0700 (PDT) Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi. [80.220.80.68]) by mx.google.com with ESMTPS id fy10sm35354196lab.0.2012.06.19.13.14.50 (version=SSLv3 cipher=OTHER); Tue, 19 Jun 2012 13:14:51 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v2] emacs: add function to toggle display of all multipart/alternative parts Date: Tue, 19 Jun 2012 23:14:49 +0300 Message-Id: <1340136889-2992-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1339775751-18002-1-git-send-email-jani@nikula.org> References: <1339775751-18002-1-git-send-email-jani@nikula.org> X-Gm-Message-State: ALoCoQnYwwvFIGHEaq4LQAZV+lSUFpcaFpgUZomw3HYrnnZbJx8/FiNlAhmYuyQkiAOZ3+dBXSjI X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 20:14:55 -0000 Add function notmuch-show-toggle-multipart-alternative to toggle the value of notmuch-show-all-multipart/alternative-parts variable in the buffer, and redisplay the thread with either all or preferred alternative parts expanded. A small wrinkle is that in order to make the variable survive notmuch-show-refresh-view (which is required for expanding/collapsing the parts, but ends up calling kill-all-local-variables through notmuch-show-mode) it is necessary to give it the permanent-local property. --- emacs/notmuch-show.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 36cad93..4d3f03f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -98,6 +98,18 @@ any given message." "Should all parts of multipart/alternative parts be shown?" :type 'boolean :group 'notmuch-show) +(make-variable-buffer-local 'notmuch-show-all-multipart/alternative-parts) +(put 'notmuch-show-all-multipart/alternative-parts 'permanent-local t) + +(defun notmuch-show-toggle-multipart-alternative () + "Toggle the display of all multipart/alternative parts." + (interactive) + (setq notmuch-show-all-multipart/alternative-parts + (not notmuch-show-all-multipart/alternative-parts)) + (message (if notmuch-show-all-multipart/alternative-parts + "Showing all multipart/alternative parts." + "Showing preferred multipart/alternative part.")) + (notmuch-show-refresh-view)) (defcustom notmuch-show-indent-messages-width 1 "Width of message indentation in threads. -- 1.7.9.5