From c2a5709e186ac3ad73d15dcda95796b121fb152b Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Tue, 31 Jan 2012 08:46:58 +0000 Subject: [PATCH 1/1] [PATCH 3/5] emacs: Allow the indentation of content to be toggled. --- bc/d1406c4145e78eeaa0a2afdfbe5aaabfec2c44 | 142 ++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 bc/d1406c4145e78eeaa0a2afdfbe5aaabfec2c44 diff --git a/bc/d1406c4145e78eeaa0a2afdfbe5aaabfec2c44 b/bc/d1406c4145e78eeaa0a2afdfbe5aaabfec2c44 new file mode 100644 index 000000000..8158e5474 --- /dev/null +++ b/bc/d1406c4145e78eeaa0a2afdfbe5aaabfec2c44 @@ -0,0 +1,142 @@ +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 E6C23414B85 + for ; Tue, 31 Jan 2012 00:47:08 -0800 (PST) +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 FrBv2UjtS4nH for ; + Tue, 31 Jan 2012 00:47:07 -0800 (PST) +Received: from mail-we0-f181.google.com (mail-we0-f181.google.com + [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D106B41ED96 + for ; Tue, 31 Jan 2012 00:47:06 -0800 (PST) +Received: by werb10 with SMTP id b10so4655480wer.26 + for ; Tue, 31 Jan 2012 00:47:05 -0800 (PST) +Received: by 10.180.106.33 with SMTP id gr1mr32811069wib.6.1327999625532; + Tue, 31 Jan 2012 00:47:05 -0800 (PST) +Received: from hotblack-desiato.hh.sledj.net + (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) + by mx.google.com with ESMTPS id fr8sm60762217wib.10.2012.01.31.00.47.03 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 31 Jan 2012 00:47:03 -0800 (PST) +Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) + id D36E4A02EC; Tue, 31 Jan 2012 08:47:01 +0000 (GMT) +From: David Edmondson +To: notmuch@notmuchmail.org +Subject: [PATCH 3/5] emacs: Allow the indentation of content to be toggled. +Date: Tue, 31 Jan 2012 08:46:58 +0000 +Message-Id: <1327999620-14595-4-git-send-email-dme@dme.org> +X-Mailer: git-send-email 1.7.8.3 +In-Reply-To: <1327999620-14595-1-git-send-email-dme@dme.org> +References: + <1327999620-14595-1-git-send-email-dme@dme.org> +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, 31 Jan 2012 08:47:09 -0000 + +Very deeply indented content is sometimes difficult to +read (particular for something like patches). Allow the indentation of +the content to be toggled with '<'. + +Indentation of the header lines is not affected, so it remains +possible to see the structure of the thread. +--- + emacs/notmuch-show.el | 26 ++++++++++++++++++++++---- + 1 files changed, 22 insertions(+), 4 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 77ba2dd..789b6d9 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -140,6 +140,10 @@ indentation." + (make-variable-buffer-local 'notmuch-show-elide-non-matching-messages) + (put 'notmuch-show-elide-non-matching-messages 'permanent-local t) + ++(defvar notmuch-show-indent-content t) ++(make-variable-buffer-local 'notmuch-show-indent-content) ++(put 'notmuch-show-indent-content 'permanent-local t) ++ + (defmacro with-current-notmuch-show-message (&rest body) + "Evaluate body with current buffer set to the text of current message" + `(save-excursion +@@ -250,10 +254,12 @@ operation on the contents of the current buffer." + (all (buffer-substring (notmuch-show-message-top) + (notmuch-show-message-bottom))) + +- (props (notmuch-show-get-message-properties))) ++ (props (notmuch-show-get-message-properties)) ++ (indenting notmuch-show-indent-content)) + (with-temp-buffer + (insert all) +- (indent-rigidly (point-min) (point-max) (- depth)) ++ (if indenting ++ (indent-rigidly (point-min) (point-max) (- depth))) + ;; Remove the original header. + (goto-char (point-min)) + (re-search-forward "^$" (point-max) nil) +@@ -881,7 +887,8 @@ current buffer, if possible." + (setq notmuch-show-previous-subject bare-subject) + + (setq body-start (point-marker)) +- (notmuch-show-insert-body msg (plist-get msg :body) depth) ++ (notmuch-show-insert-body msg (plist-get msg :body) ++ (if notmuch-show-indent-content depth 0)) + ;; Ensure that the body ends with a newline. + (unless (bolp) + (insert "\n")) +@@ -889,7 +896,8 @@ current buffer, if possible." + (setq content-end (point-marker)) + + ;; Indent according to the depth in the thread. +- (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth)) ++ (if notmuch-show-indent-content ++ (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth))) + + (setq message-end (point-max-marker)) + +@@ -936,6 +944,15 @@ current buffer, if possible." + "Showing all messages.")) + (notmuch-show-refresh-view)) + ++(defun notmuch-show-toggle-thread-indentation () ++ "Toggle the indentation of threads." ++ (interactive) ++ (setq notmuch-show-indent-content (not notmuch-show-indent-content)) ++ (message (if notmuch-show-indent-content ++ "Content is indented." ++ "Content is not indented.")) ++ (notmuch-show-refresh-view)) ++ + (defun notmuch-show-insert-tree (tree depth) + "Insert the message tree TREE at depth DEPTH in the current thread." + (let ((msg (car tree)) +@@ -1098,6 +1115,7 @@ Refreshes the current view, observing changes in cryptographic preferences." + (define-key map "#" 'notmuch-show-print-message) + (define-key map "!" 'notmuch-show-toggle-elide-non-matching) + (define-key map "$" 'notmuch-show-toggle-process-crypto) ++ (define-key map "<" 'notmuch-show-toggle-thread-indentation) + map) + "Keymap for \"notmuch show\" buffers.") + (fset 'notmuch-show-mode-map notmuch-show-mode-map) +-- +1.7.8.3 + -- 2.26.2