From: Jani Nikula Date: Fri, 15 Jun 2012 15:55:51 +0000 (+0300) Subject: [PATCH] emacs: add function to toggle display of all multipart/alternative parts X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=7e470b8ac9eb3595e650410621b5a847415107d3;p=notmuch-archives.git [PATCH] emacs: add function to toggle display of all multipart/alternative parts --- diff --git a/a6/253fd61c692aec155d5cf4b33ba12457bcdae3 b/a6/253fd61c692aec155d5cf4b33ba12457bcdae3 new file mode 100644 index 000000000..baec81ae1 --- /dev/null +++ b/a6/253fd61c692aec155d5cf4b33ba12457bcdae3 @@ -0,0 +1,101 @@ +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 51DBA431FB6 + for ; Fri, 15 Jun 2012 08:55:56 -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 yR89tORVvnzO for ; + Fri, 15 Jun 2012 08:55:56 -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 B07F3431FAE + for ; Fri, 15 Jun 2012 08:55:55 -0700 (PDT) +Received: by lbbgk8 with SMTP id gk8so3243772lbb.26 + for ; Fri, 15 Jun 2012 08:55:54 -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:x-gm-message-state; + bh=4A6+jH/oUcowNZW+KiSAzggSxrWY3b0TWvTdn13Fo1o=; + b=fHuHSYhOQHApO2ek+O97S1ByrjxDj8rwHntv5HrTV7x68XQpyONw/YS0so0lNQoJOo + rOwmYtoQs4Mi73ZDjHiHxCR8gj5nfGM6ZIm08AfOW5ddsICodk4mga5kSRbimSk6MC8y + vMvgKwHa1/rKZ8OxSQGb1UTJpNuD2OIehxgBU+cQrfF22M4ii68Q/p4H5cIWpmONZVzN + S35DhytBOTHjmW/xKra7VwgycJlZNNo15iUX3mXEG1LLw+vumWCyAN4tO5xXT5vngZ1C + /caBODQKJir5m2YQq9B/d0oVf1Mo200f54GMDV6HjfdPR8y0EgY9CDBTlxtn3Ye+yEDy + riCA== +Received: by 10.152.108.178 with SMTP id hl18mr6037898lab.11.1339775754203; + Fri, 15 Jun 2012 08:55:54 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi. + [80.220.80.68]) by mx.google.com with ESMTPS id + gi19sm12966622lab.16.2012.06.15.08.55.52 + (version=SSLv3 cipher=OTHER); Fri, 15 Jun 2012 08:55:53 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: add function to toggle display of all + multipart/alternative parts +Date: Fri, 15 Jun 2012 18:55:51 +0300 +Message-Id: <1339775751-18002-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.7.9.5 +X-Gm-Message-State: + ALoCoQng8+ac74X9b8NhpH8Zg4peLY00fhRpVNLAVFNt7uXiNyBBhfneBoJu3CI/qBDSy+Knqcbi +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: Fri, 15 Jun 2012 15:55:56 -0000 + +Add function notmuch-show-toggle-multipart-alternative to make +notmuch-show-all-multipart/alternative-parts buffer local, toggle its +value 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 | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 36cad93..9c177d9 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -99,6 +99,17 @@ any given message." + :type 'boolean + :group 'notmuch-show) + ++(defun notmuch-show-toggle-multipart-alternative () ++ "Toggle `notmuch-show-all-multipart/alternative-parts' in the buffer." ++ (interactive) ++ (unless (local-variable-p 'notmuch-show-all-multipart/alternative-parts) ++ (make-local-variable 'notmuch-show-all-multipart/alternative-parts) ++ ;; Make it permanently local to survive notmuch-show-refresh-view. ++ (put 'notmuch-show-all-multipart/alternative-parts 'permanent-local t)) ++ (setq notmuch-show-all-multipart/alternative-parts ++ (not notmuch-show-all-multipart/alternative-parts)) ++ (notmuch-show-refresh-view)) ++ + (defcustom notmuch-show-indent-messages-width 1 + "Width of message indentation in threads. + +-- +1.7.9.5 +