* [PATCH] added keys to hide/show a portion of the thread
@ 2011-05-29 8:56 notmuch
2011-06-07 6:37 ` Dima Kogan
0 siblings, 1 reply; 2+ messages in thread
From: notmuch @ 2011-05-29 8:56 UTC (permalink / raw)
To: notmuch
From: Dima Kogan <dima@secretsauce.net>
---
Here's another improvement. In the notmuch-show display this binds '[' to
expand all the children messages (replies). Analogously ']' collapses all the
children messages.
dima
emacs/notmuch-show.el | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2ba151e..600f3ec 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -813,6 +813,8 @@ function is used. "
(define-key map " " 'notmuch-show-advance-and-archive)
(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
(define-key map (kbd "RET") 'notmuch-show-toggle-message)
+ (define-key map "]" 'notmuch-show-hide-hierarchy)
+ (define-key map "[" 'notmuch-show-show-hierarchy)
map)
"Keymap for \"notmuch show\" buffers.")
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1266,6 +1268,38 @@ argument, hide all of the messages."
until (not (notmuch-show-goto-message-next))))
(force-window-update))
+; get the depth, assuming the point is at the start of the header line
+(defun notmuch-show-get-depth ()
+ (save-excursion
+ (let ((start (point)))
+ (- (re-search-forward "^ *") start))))
+
+(defun notmuch-show-hideshow-hierarchy (doshow)
+ "Hides or shows this message and all its replies"
+ (interactive)
+ (save-excursion
+ (notmuch-show-move-to-message-top)
+
+ (let ((depth0 (notmuch-show-get-depth)))
+ (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+ doshow)
+ until (or (not (notmuch-show-goto-message-next))
+ (<= (notmuch-show-get-depth) depth0))))
+ (force-window-update))
+)
+
+(defun notmuch-show-show-hierarchy ()
+ "Show this message and all its replies"
+ (interactive)
+ (notmuch-show-hideshow-hierarchy 1)
+)
+
+(defun notmuch-show-hide-hierarchy ()
+ "Hide this message and all its replies"
+ (interactive)
+ (notmuch-show-hideshow-hierarchy nil)
+)
+
(defun notmuch-show-next-button ()
"Advance point to the next button in the buffer."
(interactive)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] added keys to hide/show a portion of the thread
2011-05-29 8:56 [PATCH] added keys to hide/show a portion of the thread notmuch
@ 2011-06-07 6:37 ` Dima Kogan
0 siblings, 0 replies; 2+ messages in thread
From: Dima Kogan @ 2011-06-07 6:37 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 331 bytes --]
> On Sun, 29 May 2011 01:56:44 -0700
> notmuch@dima.secretsauce.net wrote:
>
> Here's another improvement. In the notmuch-show display this binds
> '[' to expand all the children messages (replies). Analogously ']'
> collapses all the children messages.
Here's an update of the patch to conform with notmuch's indentation style.
[-- Attachment #2: 0001-added-keys-to-hide-show-a-portion-of-the-thread.patch --]
[-- Type: text/x-patch, Size: 2118 bytes --]
From 0e2ef657fe0f6e7f8f2f7e87acd1fbbf58d8d95d Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Sun, 29 May 2011 00:37:55 -0700
Subject: [PATCH] added keys to hide/show a portion of the thread
---
emacs/notmuch-show.el | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2ba151e..5ecf5ca 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -813,6 +813,8 @@ function is used. "
(define-key map " " 'notmuch-show-advance-and-archive)
(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
(define-key map (kbd "RET") 'notmuch-show-toggle-message)
+ (define-key map "]" 'notmuch-show-hide-hierarchy)
+ (define-key map "[" 'notmuch-show-show-hierarchy)
map)
"Keymap for \"notmuch show\" buffers.")
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
@@ -1266,6 +1268,35 @@ argument, hide all of the messages."
until (not (notmuch-show-goto-message-next))))
(force-window-update))
+; get the depth, assuming the point is at the start of the header line
+(defun notmuch-show-get-depth ()
+ (save-excursion
+ (let ((start (point)))
+ (- (re-search-forward "^ *") start))))
+
+(defun notmuch-show-hideshow-hierarchy (doshow)
+ "Hides or shows this message and all its replies"
+ (interactive)
+ (save-excursion
+ (notmuch-show-move-to-message-top)
+
+ (let ((depth0 (notmuch-show-get-depth)))
+ (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+ doshow)
+ until (or (not (notmuch-show-goto-message-next))
+ (<= (notmuch-show-get-depth) depth0))))
+ (force-window-update)))
+
+(defun notmuch-show-show-hierarchy ()
+ "Show this message and all its replies"
+ (interactive)
+ (notmuch-show-hideshow-hierarchy 1))
+
+(defun notmuch-show-hide-hierarchy ()
+ "Hide this message and all its replies"
+ (interactive)
+ (notmuch-show-hideshow-hierarchy nil))
+
(defun notmuch-show-next-button ()
"Advance point to the next button in the buffer."
(interactive)
--
1.7.5.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-07 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-29 8:56 [PATCH] added keys to hide/show a portion of the thread notmuch
2011-06-07 6:37 ` Dima Kogan
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).