From e4958a66ef066fa1c724ba1e1ec07c426e58d7f7 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 19 Jun 2012 23:14:49 +0300 Subject: [PATCH] [PATCH v2] emacs: add function to toggle display of all multipart/alternative parts --- 53/82fd33171ab7f297c395b3f0d6641e7841601a | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 53/82fd33171ab7f297c395b3f0d6641e7841601a diff --git a/53/82fd33171ab7f297c395b3f0d6641e7841601a b/53/82fd33171ab7f297c395b3f0d6641e7841601a new file mode 100644 index 000000000..46f122433 --- /dev/null +++ b/53/82fd33171ab7f297c395b3f0d6641e7841601a @@ -0,0 +1,105 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +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 + -- 2.26.2