unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles
@ 2012-01-25 10:18 David Edmondson
  2012-01-25 10:18 ` [PATCH 1/3] emacs: Rework crypto switch toggle David Edmondson
                   ` (9 more replies)
  0 siblings, 10 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-25 10:18 UTC (permalink / raw)
  To: notmuch

The crypto toggle previously worked using an argument to
`notmuch-show' and various other functions and relied on killing and
re-creating the notmuch-show-mode buffer. Various other
pseudo-buffer-local variables were present based on an ad-hoc scheme.

Replace the ad-hoc scheme with real buffer-local variables and then
update `notmuch-show-refresh-view' to erase and re-paint rather than
kill and re-create. Update the crypto switch accordingly.

Add two other toggles:
    - whether non-matching messages are available,
    - the indentation of message contents.
Both of these default to the current behaviour.

A wart in the first patch is the handling of the
`notmuch-show-process-crypto' default. It is set based on
`notmuch-crypto-process-mime', but the users choice of setting for
that variable may not have been applied at the point where
`notmuch-show-process-crypto' inherits it.

My inclination is to remove `notmuch-crypto-process-mime' altogether
(declared it an obsolete variable) and allow users to set a default
for `notmuch-show-process-crypto' directly, but that is not done in
this patchset while awaiting feedback.

`notmuch-crypto-process-mime' is used only in notmuch-show.el, so the
setting really belongs there with an appropriate name.

David Edmondson (3):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.

 emacs/notmuch-show.el |  143 +++++++++++++++++++++++++++++--------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 87 insertions(+), 63 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH 1/3] emacs: Rework crypto switch toggle.
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
@ 2012-01-25 10:18 ` David Edmondson
  2012-01-25 10:18 ` [PATCH 2/3] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-25 10:18 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  102 ++++++++++++++++++++++--------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 50 insertions(+), 59 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..ed77474 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -123,6 +123,17 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+
+(defvar notmuch-show-process-crypto notmuch-crypto-process-mime)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -379,14 +390,11 @@ message at DEPTH in the current thread."
 
 (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
   (declare (indent 2))
-  (let ((process-crypto (make-symbol "process-crypto")))
-    `(let ((,process-crypto notmuch-show-process-crypto))
-       (with-temp-buffer
-	 (setq notmuch-show-process-crypto ,process-crypto)
-	 ;; Always acquires the part via `notmuch part', even if it is
-	 ;; available in the JSON output.
-	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
-	 ,@body))))
+  `(with-temp-buffer
+     ;; Always acquires the part via `notmuch part', even if it is
+     ;; available in the JSON output.
+     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
+     ,@body))
 
 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
   (notmuch-with-temp-part-buffer message-id nth
@@ -567,7 +575,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -593,7 +601,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -720,8 +728,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -875,6 +881,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -890,15 +905,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -918,7 +924,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -933,24 +939,17 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    (notmuch-show-worker thread-id parent-buffer query-context)))
+
+(defun notmuch-show-worker (thread-id parent-buffer query-context)
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
@@ -958,8 +957,6 @@ buffer."
     (setq notmuch-show-thread-id thread-id)
     (setq notmuch-show-parent-buffer parent-buffer)
     (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
 
     (erase-buffer)
     (goto-char (point-min))
@@ -989,21 +986,15 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
+		       notmuch-show-query-context))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1053,6 +1044,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6b2c252..a427e96 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -436,9 +436,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
@@ -452,8 +452,7 @@ Complete list of currently available key bindings:
 			 (concat "*"
 				 (truncate-string-to-width subject 32 nil nil t)
 				 "*")
-			 32 nil nil t))
-		      crypto-switch)
+			 32 nil nil t)))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 2/3] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
  2012-01-25 10:18 ` [PATCH 1/3] emacs: Rework crypto switch toggle David Edmondson
@ 2012-01-25 10:18 ` David Edmondson
  2012-01-25 10:18 ` [PATCH 3/3] emacs: Allow the indentation of content to be toggled David Edmondson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-25 10:18 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ed77474..916b941 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -134,6 +134,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -890,11 +894,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1044,6 +1059,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 3/3] emacs: Allow the indentation of content to be toggled.
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
  2012-01-25 10:18 ` [PATCH 1/3] emacs: Rework crypto switch toggle David Edmondson
  2012-01-25 10:18 ` [PATCH 2/3] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-01-25 10:18 ` David Edmondson
  2012-01-29 22:30   ` Mark Walters
  2012-01-29 20:06 ` [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles Jameson Graef Rollins
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-01-25 10:18 UTC (permalink / raw)
  To: notmuch

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 |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 916b941..337cd50 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -138,6 +138,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
@@ -244,10 +248,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)
@@ -856,7 +862,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))
 
@@ -903,6 +910,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))
@@ -1061,6 +1077,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (2 preceding siblings ...)
  2012-01-25 10:18 ` [PATCH 3/3] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-01-29 20:06 ` Jameson Graef Rollins
  2012-01-30  9:37   ` David Edmondson
  2012-01-30 11:31 ` [PATCH 0/3 v2] " David Edmondson
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 87+ messages in thread
From: Jameson Graef Rollins @ 2012-01-29 20:06 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 2073 bytes --]

On Wed, 25 Jan 2012 10:18:46 +0000, David Edmondson <dme@dme.org> wrote:
> The crypto toggle previously worked using an argument to
> `notmuch-show' and various other functions and relied on killing and
> re-creating the notmuch-show-mode buffer. Various other
> pseudo-buffer-local variables were present based on an ad-hoc scheme.
>
> Replace the ad-hoc scheme with real buffer-local variables and then
> update `notmuch-show-refresh-view' to erase and re-paint rather than
> kill and re-create. Update the crypto switch accordingly.

Hey, David.  Thank you so much for this!  I was really hoping someone
would eventually pick this up, and your solution is great!  This new
behavior is *much* nicer.  I really like it.

I haven't done a full code review, though, just tested it out.  I may
not be able to get to it for a while, so please don't hold this patch up
on my account).

> Add two other toggles:
>     - whether non-matching messages are available,
>     - the indentation of message contents.
> Both of these default to the current behaviour.

These new features enabled by this are very cool!  I love them both.  I
bet there are other interesting toggle features that could be enabled by
this.

> My inclination is to remove `notmuch-crypto-process-mime' altogether
> (declared it an obsolete variable) and allow users to set a default
> for `notmuch-show-process-crypto' directly, but that is not done in
> this patchset while awaiting feedback.

I'm not sure I understand this.  `notmuch-show-process-crypto' *is* what
sets the default for the `notmuch-show-process-crypto' buffer-local
variable.  How would you change the current behavior or settings (beyond
just a variable rename)?

> `notmuch-crypto-process-mime' is used only in notmuch-show.el, so the
> setting really belongs there with an appropriate name.

I intentionally put this in a separate section in case there were
eventually other needs for this setting beyond just show mode.  I
personally think we should just leave it where it is, particularly since
it's been there for a while.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 3/3] emacs: Allow the indentation of content to be toggled.
  2012-01-25 10:18 ` [PATCH 3/3] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-01-29 22:30   ` Mark Walters
  2012-01-30  9:29     ` David Edmondson
  2012-01-30 16:32     ` David Edmondson
  0 siblings, 2 replies; 87+ messages in thread
From: Mark Walters @ 2012-01-29 22:30 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Wed, 25 Jan 2012 10:18:49 +0000, David Edmondson <dme@dme.org> wrote:
> 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.

I really like the feature and would definitely use it. However, I have a
couple of niggles with the implementation. First, when toggled it seems
to redisplay so it jumps back to the first matching message regardless
of where you are in the thread (and closes messages you have opened).

Secondly, it doesn't seem to interact correctly with
notmuch-wash-wrap-long-lines (the lines wrap at the place they would
have wrapped had the text been indented).

[I haven't yet worked how out notmuch-wash-wrap-long-lines and visual line
mode etc are intended to interact so maybe the second point is moot.]

Best wishes

Mark

(Sorry for the resend: I sent from the wrong address again)

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 3/3] emacs: Allow the indentation of content to be toggled.
  2012-01-29 22:30   ` Mark Walters
@ 2012-01-30  9:29     ` David Edmondson
  2012-01-30 16:32     ` David Edmondson
  1 sibling, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30  9:29 UTC (permalink / raw)
  To: Mark Walters, notmuch

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

On Sun, 29 Jan 2012 22:30:42 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> First, when toggled it seems to redisplay so it jumps back to the
> first matching message regardless of where you are in the thread (and
> closes messages you have opened).

Yes, I agree that is annoying. Annoying enough to block the patch until
it's fixed? (I'd argue no, but I'm interested in opinions.)

> Secondly, it doesn't seem to interact correctly with
> notmuch-wash-wrap-long-lines (the lines wrap at the place they would
> have wrapped had the text been indented).

That's a bug. I'll fix it.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles
  2012-01-29 20:06 ` [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles Jameson Graef Rollins
@ 2012-01-30  9:37   ` David Edmondson
  2012-01-30 11:26     ` David Edmondson
  0 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-01-30  9:37 UTC (permalink / raw)
  To: Jameson Graef Rollins, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 721 bytes --]

On Sun, 29 Jan 2012 12:06:57 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > My inclination is to remove `notmuch-crypto-process-mime' altogether
> > (declared it an obsolete variable) and allow users to set a default
> > for `notmuch-show-process-crypto' directly, but that is not done in
> > this patchset while awaiting feedback.
> 
> I'm not sure I understand this.  `notmuch-show-process-crypto' *is* what
> sets the default for the `notmuch-show-process-crypto' buffer-local
> variable.  How would you change the current behavior or settings (beyond
> just a variable rename)?

The problem with the code as I posted can be seen if you imagine the
following ~/.emacs.el sequence:


[-- Attachment #1.2: Type: application/emacs-lisp, Size: 533 bytes --]

[-- Attachment #1.3: Type: text/plain, Size: 530 bytes --]


I'm sure that I can figure out either some `defcustom' goop or worse to
sort it out so that the initialisation happens correctly.

> > `notmuch-crypto-process-mime' is used only in notmuch-show.el, so the
> > setting really belongs there with an appropriate name.
> 
> I intentionally put this in a separate section in case there were
> eventually other needs for this setting beyond just show mode.  I
> personally think we should just leave it where it is, particularly
> since it's been there for a while.

Okay.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles
  2012-01-30  9:37   ` David Edmondson
@ 2012-01-30 11:26     ` David Edmondson
  2012-01-30 17:44       ` Jameson Graef Rollins
  0 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-01-30 11:26 UTC (permalink / raw)
  To: Jameson Graef Rollins, notmuch

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

On Mon, 30 Jan 2012 09:37:17 +0000, David Edmondson <dme@dme.org> wrote:
> On Sun, 29 Jan 2012 12:06:57 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > > My inclination is to remove `notmuch-crypto-process-mime' altogether
> > > (declared it an obsolete variable) and allow users to set a default
> > > for `notmuch-show-process-crypto' directly, but that is not done in
> > > this patchset while awaiting feedback.
> > 
> > I'm not sure I understand this.  `notmuch-show-process-crypto' *is* what
> > sets the default for the `notmuch-show-process-crypto' buffer-local
> > variable.  How would you change the current behavior or settings (beyond
> > just a variable rename)?
> 
> [...]
>
> I'm sure that I can figure out either some `defcustom' goop or worse to
> sort it out so that the initialisation happens correctly.

The simplest approach is to have `notmuch-show-process-crypto' inherit
the value of `notmuch-crypto-process-mime' when any `notmuch-show-mode'
buffers are first created. Currently that happens in only one place
(`notmuch-show'), which makes things straightforward.

Updated patches soon.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH 0/3 v2] reworked crypto toggle, plus a couple of other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (3 preceding siblings ...)
  2012-01-29 20:06 ` [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles Jameson Graef Rollins
@ 2012-01-30 11:31 ` David Edmondson
  2012-01-30 11:31   ` [PATCH 1/3 v2] emacs: Rework crypto switch toggle David Edmondson
                     ` (2 more replies)
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
                   ` (4 subsequent siblings)
  9 siblings, 3 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 11:31 UTC (permalink / raw)
  To: notmuch

- Improved default for `notmuch-show-process-crypto' that is less load
  order dependant.

- Pass the _displayed_ depth of the thread to the body-insertion
  functions, allowing them to properly wrap when the content is not
  indented.

David Edmondson (3):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.

 emacs/notmuch-show.el |  149 +++++++++++++++++++++++++++++--------------------
 emacs/notmuch.el      |    7 +-
 2 files changed, 92 insertions(+), 64 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH 1/3 v2] emacs: Rework crypto switch toggle.
  2012-01-30 11:31 ` [PATCH 0/3 v2] " David Edmondson
@ 2012-01-30 11:31   ` David Edmondson
  2012-01-30 11:31   ` [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
  2012-01-30 11:31   ` [PATCH 3/3 v2] emacs: Allow the indentation of content to be toggled David Edmondson
  2 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 11:31 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  105 +++++++++++++++++++++++-------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 53 insertions(+), 59 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 84ac624..53f6ae4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -124,6 +124,17 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+
+(defvar notmuch-show-process-crypto nil)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -410,14 +421,11 @@ message at DEPTH in the current thread."
 
 (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
   (declare (indent 2))
-  (let ((process-crypto (make-symbol "process-crypto")))
-    `(let ((,process-crypto notmuch-show-process-crypto))
-       (with-temp-buffer
-	 (setq notmuch-show-process-crypto ,process-crypto)
-	 ;; Always acquires the part via `notmuch part', even if it is
-	 ;; available in the JSON output.
-	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
-	 ,@body))))
+  `(with-temp-buffer
+     ;; Always acquires the part via `notmuch part', even if it is
+     ;; available in the JSON output.
+     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
+     ,@body))
 
 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
   (notmuch-with-temp-part-buffer message-id nth
@@ -599,7 +607,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -625,7 +633,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -752,8 +760,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -907,6 +913,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -922,15 +937,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -950,7 +956,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -965,24 +971,20 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    ;; Set the default value for `notmuch-show-process-crypto' in this
+    ;; buffer.
+    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+    (notmuch-show-worker thread-id parent-buffer query-context)))
+
+(defun notmuch-show-worker (thread-id parent-buffer query-context)
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
@@ -990,8 +992,6 @@ buffer."
     (setq notmuch-show-thread-id thread-id)
     (setq notmuch-show-parent-buffer parent-buffer)
     (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
 
     (erase-buffer)
     (goto-char (point-min))
@@ -1021,21 +1021,15 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
+		       notmuch-show-query-context))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1085,6 +1079,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 72f78ed..9d8bebd 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -463,9 +463,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
@@ -479,8 +479,7 @@ Complete list of currently available key bindings:
 			 (concat "*"
 				 (truncate-string-to-width subject 32 nil nil t)
 				 "*")
-			 32 nil nil t))
-		      crypto-switch)
+			 32 nil nil t)))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-01-30 11:31 ` [PATCH 0/3 v2] " David Edmondson
  2012-01-30 11:31   ` [PATCH 1/3 v2] emacs: Rework crypto switch toggle David Edmondson
@ 2012-01-30 11:31   ` David Edmondson
  2012-01-30 11:31   ` [PATCH 3/3 v2] emacs: Allow the indentation of content to be toggled David Edmondson
  2 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 11:31 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 53f6ae4..99478a4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -135,6 +135,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -922,11 +926,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1079,6 +1094,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 3/3 v2] emacs: Allow the indentation of content to be toggled.
  2012-01-30 11:31 ` [PATCH 0/3 v2] " David Edmondson
  2012-01-30 11:31   ` [PATCH 1/3 v2] emacs: Rework crypto switch toggle David Edmondson
  2012-01-30 11:31   ` [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-01-30 11:31   ` David Edmondson
  2 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 11:31 UTC (permalink / raw)
  To: notmuch

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 99478a4..a2c4daf 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -139,6 +139,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
@@ -249,10 +253,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)
@@ -880,7 +886,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"))
@@ -888,7 +895,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))
 
@@ -935,6 +943,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))
@@ -1096,6 +1113,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (4 preceding siblings ...)
  2012-01-30 11:31 ` [PATCH 0/3 v2] " David Edmondson
@ 2012-01-30 16:30 ` David Edmondson
  2012-01-30 16:31   ` [PATCH 1/5] emacs: Rework crypto switch toggle David Edmondson
                     ` (6 more replies)
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
                   ` (3 subsequent siblings)
  9 siblings, 7 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:30 UTC (permalink / raw)
  To: notmuch

v3:
 - Add a toggle for line truncation (>).
 - Retain the state of a show buffer across a call to refresh (which
   includes the various toggles here).

David Edmondson (5):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.
  emacs: Add a binding (>) to toggle the truncation of long lines.
  emacs: Retain the state of the buffer during
    `notmuch-show-refresh-view'.

 emacs/notmuch-show.el |  183 +++++++++++++++++++++++++++++++++----------------
 emacs/notmuch.el      |    7 +-
 2 files changed, 126 insertions(+), 64 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH 1/5] emacs: Rework crypto switch toggle.
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-01-30 16:31   ` David Edmondson
  2012-01-30 16:31   ` [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:31 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  105 +++++++++++++++++++++++-------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 53 insertions(+), 59 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 84ac624..53f6ae4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -124,6 +124,17 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+
+(defvar notmuch-show-process-crypto nil)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -410,14 +421,11 @@ message at DEPTH in the current thread."
 
 (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
   (declare (indent 2))
-  (let ((process-crypto (make-symbol "process-crypto")))
-    `(let ((,process-crypto notmuch-show-process-crypto))
-       (with-temp-buffer
-	 (setq notmuch-show-process-crypto ,process-crypto)
-	 ;; Always acquires the part via `notmuch part', even if it is
-	 ;; available in the JSON output.
-	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
-	 ,@body))))
+  `(with-temp-buffer
+     ;; Always acquires the part via `notmuch part', even if it is
+     ;; available in the JSON output.
+     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
+     ,@body))
 
 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
   (notmuch-with-temp-part-buffer message-id nth
@@ -599,7 +607,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -625,7 +633,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -752,8 +760,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -907,6 +913,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -922,15 +937,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -950,7 +956,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -965,24 +971,20 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    ;; Set the default value for `notmuch-show-process-crypto' in this
+    ;; buffer.
+    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+    (notmuch-show-worker thread-id parent-buffer query-context)))
+
+(defun notmuch-show-worker (thread-id parent-buffer query-context)
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
@@ -990,8 +992,6 @@ buffer."
     (setq notmuch-show-thread-id thread-id)
     (setq notmuch-show-parent-buffer parent-buffer)
     (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
 
     (erase-buffer)
     (goto-char (point-min))
@@ -1021,21 +1021,15 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
+		       notmuch-show-query-context))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1085,6 +1079,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 72f78ed..9d8bebd 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -463,9 +463,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
@@ -479,8 +479,7 @@ Complete list of currently available key bindings:
 			 (concat "*"
 				 (truncate-string-to-width subject 32 nil nil t)
 				 "*")
-			 32 nil nil t))
-		      crypto-switch)
+			 32 nil nil t)))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-01-30 16:31   ` [PATCH 1/5] emacs: Rework crypto switch toggle David Edmondson
@ 2012-01-30 16:31   ` David Edmondson
  2012-01-30 16:31   ` [PATCH 3/5] emacs: Allow the indentation of content to be toggled David Edmondson
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:31 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 53f6ae4..99478a4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -135,6 +135,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -922,11 +926,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1079,6 +1094,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-01-30 16:31   ` [PATCH 1/5] emacs: Rework crypto switch toggle David Edmondson
  2012-01-30 16:31   ` [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-01-30 16:31   ` David Edmondson
  2012-01-30 16:31   ` [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines David Edmondson
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:31 UTC (permalink / raw)
  To: notmuch

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 99478a4..a2c4daf 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -139,6 +139,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
@@ -249,10 +253,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)
@@ -880,7 +886,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"))
@@ -888,7 +895,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))
 
@@ -935,6 +943,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))
@@ -1096,6 +1113,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines.
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (2 preceding siblings ...)
  2012-01-30 16:31   ` [PATCH 3/5] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-01-30 16:31   ` David Edmondson
  2012-01-30 17:33     ` Jani Nikula
  2012-01-30 16:31   ` [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
                     ` (2 subsequent siblings)
  6 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:31 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a2c4daf..8b07adf 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1114,6 +1114,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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)
+	(define-key map ">" 'toggle-truncate-lines)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (3 preceding siblings ...)
  2012-01-30 16:31   ` [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines David Edmondson
@ 2012-01-30 16:31   ` David Edmondson
  2012-01-30 20:19     ` Mark Walters
  2012-01-30 17:03   ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles Tomi Ollila
  2012-01-30 17:47   ` Jameson Graef Rollins
  6 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:31 UTC (permalink / raw)
  To: notmuch

Record the state of the buffer during `notmuch-show-refresh-view'.

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.
---
 emacs/notmuch-show.el |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8b07adf..a77cd52 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1053,15 +1053,48 @@ function is used."
 
     (notmuch-show-mark-read)))
 
+(defun notmuch-show-capture-state ()
+  "Capture the state of the current buffer.
+
+This includes:
+ - the list of open messages,
+ - the current message."
+  (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
+
+(defun notmuch-show-apply-state (state)
+  "Apply STATE to the current buffer.
+
+This includes:
+ - opening the messages previously opened,
+ - closing all other messages,
+ - moving to the correct current message."
+  (let ((current (car state))
+	(open (cadr state)))
+
+    ;; Open those that were open.
+    (goto-char (point-min))
+    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+					   (member (notmuch-show-get-message-id) open))
+	  until (not (notmuch-show-goto-message-next)))
+
+    ;; Go to the previously open message.
+    (goto-char (point-min))
+    (unless (loop if (string= current (notmuch-show-get-message-id))
+		  return t
+		  until (not (notmuch-show-goto-message-next)))
+      (message "Previously current message not found."))))
+
 (defun notmuch-show-refresh-view ()
   "Refresh the current view.
 
 Refreshes the current view, observing changes in cryptographic preferences."
   (interactive)
-  (let ((inhibit-read-only t))
-    (erase-buffer))
-  (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
-		       notmuch-show-query-context))
+  (let ((inhibit-read-only t)
+	(state (notmuch-show-capture-state)))
+    (erase-buffer)
+    (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
+			 notmuch-show-query-context)
+    (notmuch-show-apply-state state)))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH 3/3] emacs: Allow the indentation of content to be toggled.
  2012-01-29 22:30   ` Mark Walters
  2012-01-30  9:29     ` David Edmondson
@ 2012-01-30 16:32     ` David Edmondson
  1 sibling, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 16:32 UTC (permalink / raw)
  To: Mark Walters, notmuch

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

On Sun, 29 Jan 2012 22:30:42 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> I really like the feature and would definitely use it. However, I have a
> couple of niggles with the implementation. First, when toggled it seems
> to redisplay so it jumps back to the first matching message regardless
> of where you are in the thread (and closes messages you have opened).

v3 is supposed to address this. Please test.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (4 preceding siblings ...)
  2012-01-30 16:31   ` [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-01-30 17:03   ` Tomi Ollila
  2012-01-30 17:47   ` Jameson Graef Rollins
  6 siblings, 0 replies; 87+ messages in thread
From: Tomi Ollila @ 2012-01-30 17:03 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Mon, 30 Jan 2012 16:30:59 +0000, David Edmondson <dme@dme.org> wrote:
> v3:
>  - Add a toggle for line truncation (>).
>  - Retain the state of a show buffer across a call to refresh (which
>    includes the various toggles here).

Applied and tested -- patches 2-5 works fine -- I currently don't have
any messages to test 1.

> David Edmondson (5):
>   emacs: Rework crypto switch toggle.
>   emacs: Allow `notmuch-show-mode' to display only matching messages.
>   emacs: Allow the indentation of content to be toggled.
>   emacs: Add a binding (>) to toggle the truncation of long lines.
>   emacs: Retain the state of the buffer during
>     `notmuch-show-refresh-view'.

So +1

Tomi

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines.
  2012-01-30 16:31   ` [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines David Edmondson
@ 2012-01-30 17:33     ` Jani Nikula
  2012-01-30 17:45       ` David Edmondson
  0 siblings, 1 reply; 87+ messages in thread
From: Jani Nikula @ 2012-01-30 17:33 UTC (permalink / raw)
  To: David Edmondson; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

On Jan 30, 2012 6:31 PM, "David Edmondson" <dme@dme.org> wrote:
>
> ---
>  emacs/notmuch-show.el |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index a2c4daf..8b07adf 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1114,6 +1114,7 @@ Refreshes the current view, observing changes in
cryptographic preferences."
>        (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)
> +       (define-key map ">" 'toggle-truncate-lines)

Okay, this is bikeshedding, but we have ¦ to pipe a message - wouldn't it
be appropriate to reserve > for saving a message to file?

>        map)
>       "Keymap for \"notmuch show\" buffers.")
>  (fset 'notmuch-show-mode-map notmuch-show-mode-map)
> --
> 1.7.8.3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: Type: text/html, Size: 1594 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles
  2012-01-30 11:26     ` David Edmondson
@ 2012-01-30 17:44       ` Jameson Graef Rollins
  0 siblings, 0 replies; 87+ messages in thread
From: Jameson Graef Rollins @ 2012-01-30 17:44 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

On Mon, 30 Jan 2012 11:26:32 +0000, David Edmondson <dme@dme.org> wrote:
> The simplest approach is to have `notmuch-show-process-crypto' inherit
> the value of `notmuch-crypto-process-mime' when any `notmuch-show-mode'
> buffers are first created. Currently that happens in only one place
> (`notmuch-show'), which makes things straightforward.
> 
> Updated patches soon.

Nice.  That's the right solution.  Thanks.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines.
  2012-01-30 17:33     ` Jani Nikula
@ 2012-01-30 17:45       ` David Edmondson
  0 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-30 17:45 UTC (permalink / raw)
  To: Jani Nikula; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

On Mon, 30 Jan 2012 19:33:10 +0200, Jani Nikula <jani@nikula.org> wrote:
> > +       (define-key map ">" 'toggle-truncate-lines)
> 
> Okay, this is bikeshedding, but we have ¦ to pipe a message - wouldn't it
> be appropriate to reserve > for saving a message to file?

No, that's "o" for 'output'. :-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (5 preceding siblings ...)
  2012-01-30 17:03   ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles Tomi Ollila
@ 2012-01-30 17:47   ` Jameson Graef Rollins
  2012-01-31  8:09     ` David Edmondson
  6 siblings, 1 reply; 87+ messages in thread
From: Jameson Graef Rollins @ 2012-01-30 17:47 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

On Mon, 30 Jan 2012 16:30:59 +0000, David Edmondson <dme@dme.org> wrote:
> v3:
>  - Add a toggle for line truncation (>).
>  - Retain the state of a show buffer across a call to refresh (which
>    includes the various toggles here).
> 
> David Edmondson (5):
>   emacs: Rework crypto switch toggle.
>   emacs: Allow `notmuch-show-mode' to display only matching messages.
>   emacs: Allow the indentation of content to be toggled.
>   emacs: Add a binding (>) to toggle the truncation of long lines.
>   emacs: Retain the state of the buffer during
>     `notmuch-show-refresh-view'.
> 
>  emacs/notmuch-show.el |  183 +++++++++++++++++++++++++++++++++----------------
>  emacs/notmuch.el      |    7 +-
>  2 files changed, 126 insertions(+), 64 deletions(-)

Still testing, but so far works great.  Again, this is 

One thing I've noticed, which isn't actually part of this patch, is that
the long-line truncation doesn't respect the indentation, which makes
things look strange.

But honestly I still don't like our method of displaying threads as a
giant chain of concatenated messages with indentation.  But that's for
later work.

Again, I haven't done a code review yet, but so far this seems to work
like a charm.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-01-30 16:31   ` [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-01-30 20:19     ` Mark Walters
  2012-01-31  6:17       ` David Edmondson
  0 siblings, 1 reply; 87+ messages in thread
From: Mark Walters @ 2012-01-30 20:19 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Mon, 30 Jan 2012 16:31:04 +0000, David Edmondson <dme@dme.org> wrote:
> Record the state of the buffer during `notmuch-show-refresh-view'.
> 
> In this context, "state" is defined as:
>  - the open/closed state of each message,
>  - the current message.

This looks great! I have two very minor queries one of which may class
as bikeshedding.

The first is that I currently sometimes use = (that is
notmuch-show-refresh-view) as a way to go back to the original state (ie
which messages are open and back to the first message) so I am not sure
the keep state version should completely replace the old one. (Maybe
there is an alternative way to achieve the same effect that I don't know!)

Secondly in

>  (defun notmuch-show-refresh-view ()
>    "Refresh the current view.
>  
>  Refreshes the current view, observing changes in cryptographic preferences."
>    (interactive)
> -  (let ((inhibit-read-only t))
> -    (erase-buffer))
> -  (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
> -		       notmuch-show-query-context))
> +  (let ((inhibit-read-only t)
> +	(state (notmuch-show-capture-state)))
> +    (erase-buffer)
> +    (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
> +			 notmuch-show-query-context)
> +    (notmuch-show-apply-state state)))

how would you feel about a (notmuch-show-message-adjust) at the end?

Other than that this is excellent.

Best wishes

Mark

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-01-30 20:19     ` Mark Walters
@ 2012-01-31  6:17       ` David Edmondson
  0 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-31  6:17 UTC (permalink / raw)
  To: Mark Walters, notmuch

[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]

On Mon, 30 Jan 2012 20:19:23 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> The first is that I currently sometimes use = (that is
> notmuch-show-refresh-view) as a way to go back to the original state (ie
> which messages are open and back to the first message) so I am not sure
> the keep state version should completely replace the old one. (Maybe
> there is an alternative way to achieve the same effect that I don't
> know!)

Thinking about it afterwards, I agree. That is:
    - '=' should behave as though the buffer was remade anew,
    - the toggle commands should retain the state.

> Secondly in
> 
> >  (defun notmuch-show-refresh-view ()
> >    "Refresh the current view.
> >  
> >  Refreshes the current view, observing changes in cryptographic preferences."
> >    (interactive)
> > -  (let ((inhibit-read-only t))
> > -    (erase-buffer))
> > -  (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
> > -		       notmuch-show-query-context))
> > +  (let ((inhibit-read-only t)
> > +	(state (notmuch-show-capture-state)))
> > +    (erase-buffer)
> > +    (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
> > +			 notmuch-show-query-context)
> > +    (notmuch-show-apply-state state)))
> 
> how would you feel about a (notmuch-show-message-adjust) at the end?

Agreed.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles
  2012-01-30 17:47   ` Jameson Graef Rollins
@ 2012-01-31  8:09     ` David Edmondson
  2012-01-31 16:31       ` Jameson Graef Rollins
  0 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-01-31  8:09 UTC (permalink / raw)
  To: Jameson Graef Rollins, notmuch

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

On Mon, 30 Jan 2012 09:47:34 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> One thing I've noticed, which isn't actually part of this patch, is that
> the long-line truncation doesn't respect the indentation, which makes
> things look strange.

Which lines are getting wrapped in a way that you don't like? The header
line? The headers? The body?

> But honestly I still don't like our method of displaying threads as a
> giant chain of concatenated messages with indentation.  But that's for
> later work.

It's inherited from sup, and is surely part of the "raison de notmuch"
:-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles
  2012-01-31  8:09     ` David Edmondson
@ 2012-01-31 16:31       ` Jameson Graef Rollins
  2012-01-31 17:01         ` David Edmondson
  0 siblings, 1 reply; 87+ messages in thread
From: Jameson Graef Rollins @ 2012-01-31 16:31 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 2244 bytes --]

On Tue, 31 Jan 2012 08:09:08 +0000, David Edmondson <dme@dme.org> wrote:
> On Mon, 30 Jan 2012 09:47:34 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > One thing I've noticed, which isn't actually part of this patch, is that
> > the long-line truncation doesn't respect the indentation, which makes
> > things look strange.
> 
> Which lines are getting wrapped in a way that you don't like? The header
> line? The headers? The body?

Header lines, such as Subject, To, Cc, etc.

> > But honestly I still don't like our method of displaying threads as a
> > giant chain of concatenated messages with indentation.  But that's for
> > later work.
> 
> It's inherited from sup, and is surely part of the "raison de notmuch"
> :-)

Inheritance is not a good justification for anything, much less
questionable UI choices (I seem to have inherited baldness from my dad.
Thanks dad).  Problems I have with the current approach:

- thread structure is opaque.  This is especially true with long
  threads, where it can be next to impossible to see which messages are
  replies to what.  This is by far my biggest pet peeve with the current
  format.

- navigation through the thread is difficult.  This is related to above.
  There's no way to simultaneously see the current message and the
  thread structure, which again, makes it very difficult to find
  children and parents.  This could possibly be fixed by having key
  bindings that would navigate through parents, children and siblings of
  the current message, but that might be tricky to implement.

- indentation of the entire message body is a really bad way to indicate
  thread depth.  I don't like how messages start to walk off screen as
  threads get longer, or how copying regions of the body brings the
  indentation with it.  Your indentation toggling will improve this a
  bit, though, but I still think it's a bandaid on the larger issue.

I must say that the approach I've been longing for is a modified version
of what mutt has: a top pain that is just the thread structure (with
nice branching lines), and a bottom pain that displays the current
message.  I think that would be a much cleaner approach.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles
  2012-01-31 16:31       ` Jameson Graef Rollins
@ 2012-01-31 17:01         ` David Edmondson
  0 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-01-31 17:01 UTC (permalink / raw)
  To: Jameson Graef Rollins, notmuch

[-- Attachment #1: Type: text/plain, Size: 3541 bytes --]

On Tue, 31 Jan 2012 08:31:26 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Tue, 31 Jan 2012 08:09:08 +0000, David Edmondson <dme@dme.org> wrote:
> > On Mon, 30 Jan 2012 09:47:34 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > > One thing I've noticed, which isn't actually part of this patch, is that
> > > the long-line truncation doesn't respect the indentation, which makes
> > > things look strange.
> > 
> > Which lines are getting wrapped in a way that you don't like? The header
> > line? The headers? The body?
> 
> Header lines, such as Subject, To, Cc, etc.

You could try out id:"1327565871-19729-3-git-send-email-dme@dme.org".

> > > But honestly I still don't like our method of displaying threads as a
> > > giant chain of concatenated messages with indentation.  But that's for
> > > later work.
> > 
> > It's inherited from sup, and is surely part of the "raison de notmuch"
> > :-)
> 
> Inheritance is not a good justification for anything, much less
> questionable UI choices (I seem to have inherited baldness from my dad.
> Thanks dad).

I didn't suggest that inheritance was justification. Whether it's a
questionable UI choice is largely a matter of personal preference. When
Carl started the project he chose to follow sup's example in this
respect. (Though sup is more aggressive in scrolling the display to the
left to accommodate deep threads.)

> Problems I have with the current approach:
> 
> - thread structure is opaque.  This is especially true with long
>   threads, where it can be next to impossible to see which messages are
>   replies to what.  This is by far my biggest pet peeve with the current
>   format.

A collapsed view of the current `notmuch-show-mode' buffer is not very
different to a mutt index view.

> - navigation through the thread is difficult.  This is related to above.
>   There's no way to simultaneously see the current message and the
>   thread structure, which again, makes it very difficult to find
>   children and parents.  This could possibly be fixed by having key
>   bindings that would navigate through parents, children and siblings of
>   the current message, but that might be tricky to implement.

It would be relatively simple to add the bindings you describe, based on
the computed thread depth of messages. So far I haven't particularly
missed being able to do it.

> - indentation of the entire message body is a really bad way to indicate
>   thread depth. I don't like how messages start to walk off screen as
>   threads get longer, or how copying regions of the body brings the
>   indentation with it.  Your indentation toggling will improve this a
>   bit, though, but I still think it's a bandaid on the larger issue.

The indentation works well until threads are more than about ten levels
deep, I find. It becomes unworkable after about twenty levels (but
conversations that deep tend to stress both the UI and myself in other
ways as well).

I don't copy regions of the `notmuch-show-mode' buffer, so that hasn't
been a problem.

> I must say that the approach I've been longing for is a modified version
> of what mutt has: a top pain that is just the thread structure (with
> nice branching lines), and a bottom pain that displays the current
> message.  I think that would be a much cleaner approach.

Nothing precludes the implementation of what you describe. It's not hard
to see how the two approaches could live side by side.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v5 0/6] reworked crypto toggle, plus a few other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (5 preceding siblings ...)
  2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-02-01 14:39 ` David Edmondson
  2012-02-01 14:39   ` [PATCH v5 1/6] emacs: Rework crypto switch toggle David Edmondson
                     ` (5 more replies)
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                   ` (2 subsequent siblings)
  9 siblings, 6 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

v5:
 - more real buffer local variables in patch 1.
 - switch truncation toggle binding to 't'.
 - add patch 6 to check that the search buffer still exists when
   trying to select it.

David Edmondson (6):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.
  emacs: Add a binding (t) to toggle the truncation of long lines.
  emacs: Optionally retain the state of the buffer during
    `notmuch-show-refresh-view'.
  emacs: Check that the parent buffer is alive before using it.

 emacs/notmuch-show.el |  213 +++++++++++++++++++++++++++++++++----------------
 emacs/notmuch.el      |    7 +-
 2 files changed, 147 insertions(+), 73 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v5 1/6] emacs: Rework crypto switch toggle.
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
@ 2012-02-01 14:39   ` David Edmondson
  2012-02-01 14:39   ` [PATCH v5 2/6] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  126 ++++++++++++++++++++++++------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 66 insertions(+), 67 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index de9421e..b6329d2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,22 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(put 'notmuch-show-thread-id 'permanent-local t)
+
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(put 'notmuch-show-parent-buffer 'permanent-local t)
+
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+(put 'notmuch-show-query-context 'permanent-local t)
+
+(defvar notmuch-show-process-crypto nil)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -411,14 +427,11 @@ message at DEPTH in the current thread."
 
 (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
   (declare (indent 2))
-  (let ((process-crypto (make-symbol "process-crypto")))
-    `(let ((,process-crypto notmuch-show-process-crypto))
-       (with-temp-buffer
-	 (setq notmuch-show-process-crypto ,process-crypto)
-	 ;; Always acquires the part via `notmuch part', even if it is
-	 ;; available in the JSON output.
-	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
-	 ,@body))))
+  `(with-temp-buffer
+     ;; Always acquires the part via `notmuch part', even if it is
+     ;; available in the JSON output.
+     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
+     ,@body))
 
 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
   (notmuch-with-temp-part-buffer message-id nth
@@ -600,7 +613,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -626,7 +639,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -753,8 +766,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -908,6 +919,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -923,15 +943,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -951,7 +962,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -966,46 +977,41 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    ;; Set the default value for `notmuch-show-process-crypto' in this
+    ;; buffer.
+    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+
+    (setq notmuch-show-thread-id thread-id
+	  notmuch-show-parent-buffer parent-buffer
+	  notmuch-show-query-context query-context)
+    (notmuch-show-worker)))
+
+(defun notmuch-show-worker ()
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
 
-    (setq notmuch-show-thread-id thread-id)
-    (setq notmuch-show-parent-buffer parent-buffer)
-    (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
-
     (erase-buffer)
     (goto-char (point-min))
     (save-excursion
-      (let* ((basic-args (list thread-id))
-	     (args (if query-context
-		       (append (list "\'") basic-args (list "and (" query-context ")\'"))
+      (let* ((basic-args (list notmuch-show-thread-id))
+	     (args (if notmuch-show-query-context
+		       (append (list "\'") basic-args
+			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'")))))
 	(notmuch-show-insert-forest (notmuch-query-get-threads args))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
 	(when (and (eq (buffer-size) 0)
-		   query-context)
+		   notmuch-show-query-context)
 	  (notmuch-show-insert-forest
 	   (notmuch-query-get-threads basic-args))))
 
@@ -1022,21 +1028,14 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1087,6 +1086,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 72f78ed..9d8bebd 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -463,9 +463,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
@@ -479,8 +479,7 @@ Complete list of currently available key bindings:
 			 (concat "*"
 				 (truncate-string-to-width subject 32 nil nil t)
 				 "*")
-			 32 nil nil t))
-		      crypto-switch)
+			 32 nil nil t)))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 2/6] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
  2012-02-01 14:39   ` [PATCH v5 1/6] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-01 14:39   ` David Edmondson
  2012-02-01 14:39   ` [PATCH v5 3/6] emacs: Allow the indentation of content to be toggled David Edmondson
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b6329d2..df81cd1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -141,6 +141,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -928,11 +932,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1086,6 +1101,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 3/6] emacs: Allow the indentation of content to be toggled.
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
  2012-02-01 14:39   ` [PATCH v5 1/6] emacs: Rework crypto switch toggle David Edmondson
  2012-02-01 14:39   ` [PATCH v5 2/6] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-02-01 14:39   ` David Edmondson
  2012-02-01 14:39   ` [PATCH v5 4/6] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

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 df81cd1..a07a44a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -145,6 +145,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
@@ -255,10 +259,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)
@@ -886,7 +892,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"))
@@ -894,7 +901,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))
 
@@ -941,6 +949,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))
@@ -1103,6 +1120,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 4/6] emacs: Add a binding (t) to toggle the truncation of long lines.
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
                     ` (2 preceding siblings ...)
  2012-02-01 14:39   ` [PATCH v5 3/6] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-02-01 14:39   ` David Edmondson
  2012-02-01 14:39   ` [PATCH v5 5/6] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
  2012-02-01 14:39   ` [PATCH v5 6/6] emacs: Check that the parent buffer is alive before using it David Edmondson
  5 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a07a44a..8d318c9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1121,6 +1121,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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)
+	(define-key map "t" 'toggle-truncate-lines)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 5/6] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
                     ` (3 preceding siblings ...)
  2012-02-01 14:39   ` [PATCH v5 4/6] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
@ 2012-02-01 14:39   ` David Edmondson
  2012-02-01 14:39   ` [PATCH v5 6/6] emacs: Check that the parent buffer is alive before using it David Edmondson
  5 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

With an argument, record and reply the state of the buffer during
`notmuch-show-refresh-view'.

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.

Traditional use of refresh with the = key does not retain the
state. The recently introduced toggle commands ($, !, < and >) do
retain the state.
---
 emacs/notmuch-show.el |   56 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8d318c9..1b31166 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -938,7 +938,7 @@ current buffer, if possible."
   (message (if notmuch-show-process-crypto
 	       "Processing cryptographic MIME parts."
 	     "Not processing cryptographic MIME parts."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-elide-non-matching ()
   "Toggle the display of non-matching messages."
@@ -947,7 +947,7 @@ current buffer, if possible."
   (message (if notmuch-show-elide-non-matching-messages
 	       "Showing matching messages only."
 	     "Showing all messages."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-thread-indentation ()
   "Toggle the indentation of threads."
@@ -956,7 +956,7 @@ current buffer, if possible."
   (message (if notmuch-show-indent-content
 	       "Content is indented."
 	     "Content is not indented."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-insert-tree (tree depth)
   "Insert the message tree TREE at depth DEPTH in the current thread."
@@ -1060,14 +1060,54 @@ function is used."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view ()
+(defun notmuch-show-capture-state ()
+  "Capture the state of the current buffer.
+
+This includes:
+ - the list of open messages,
+ - the current message."
+  (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
+
+(defun notmuch-show-apply-state (state)
+  "Apply STATE to the current buffer.
+
+This includes:
+ - opening the messages previously opened,
+ - closing all other messages,
+ - moving to the correct current message."
+  (let ((current (car state))
+	(open (cadr state)))
+
+    ;; Open those that were open.
+    (goto-char (point-min))
+    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+					   (member (notmuch-show-get-message-id) open))
+	  until (not (notmuch-show-goto-message-next)))
+
+    ;; Go to the previously open message.
+    (goto-char (point-min))
+    (unless (loop if (string= current (notmuch-show-get-message-id))
+		  return t
+		  until (not (notmuch-show-goto-message-next)))
+      (goto-char (point-min))
+      (message "Previously current message not found."))
+    (notmuch-show-message-adjust)))
+
+(defun notmuch-show-refresh-view (&optional retain-state)
   "Refresh the current view.
 
-Refreshes the current view, observing changes in cryptographic preferences."
+Refreshes the current view, observing changes in display
+preferences. If RETAIN-STATE is non-nil then the state of the
+buffer is stored and re-applied after the refresh."
   (interactive)
-  (let ((inhibit-read-only t))
-    (erase-buffer))
-  (notmuch-show-worker))
+  (let ((inhibit-read-only t)
+	state)
+    (if retain-state
+	(setq state (notmuch-show-capture-state)))
+    (erase-buffer)
+    (notmuch-show-worker)
+    (if state
+	(notmuch-show-apply-state state))))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v5 6/6] emacs: Check that the parent buffer is alive before using it.
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
                     ` (4 preceding siblings ...)
  2012-02-01 14:39   ` [PATCH v5 5/6] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-02-01 14:39   ` David Edmondson
  5 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-01 14:39 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1b31166..895feb5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1671,7 +1671,7 @@ added."
   (interactive "P")
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
-    (when parent-buffer
+    (when (buffer-live-p parent-buffer)
       (switch-to-buffer parent-buffer)
       (notmuch-search-next-thread)
       (if show-next
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (6 preceding siblings ...)
  2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
@ 2012-02-02 11:23 ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 1/8] emacs: Rework crypto switch toggle David Edmondson
                     ` (7 more replies)
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
  9 siblings, 8 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

v6:
- add `notmuch-show-only-matching-messages' to allow a user to choose
  that as the default behaviour.
- allow a prefix argument to `notmuch-show' to invert the default
  value of `notmuch-show-only-matching-messages'.

David Edmondson (8):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.
  emacs: Add a binding (t) to toggle the truncation of long lines.
  emacs: Optionally retain the state of the buffer during
    `notmuch-show-refresh-view'.
  emacs: Check that the parent buffer is alive before using it.
  emacs: Add `notmuch-show-only-matching-messages'.
  emacs: A prefix argument to `notmuch-show' should invert the matching
        message behaviour.

 emacs/notmuch-show.el |  224 ++++++++++++++++++++++++++++++++++---------------
 emacs/notmuch.el      |    7 +-
 2 files changed, 158 insertions(+), 73 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v6 1/8] emacs: Rework crypto switch toggle.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-03 10:47     ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
                     ` (6 subsequent siblings)
  7 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  126 ++++++++++++++++++++++++------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 66 insertions(+), 67 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index de9421e..b6329d2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,22 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(put 'notmuch-show-thread-id 'permanent-local t)
+
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(put 'notmuch-show-parent-buffer 'permanent-local t)
+
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+(put 'notmuch-show-query-context 'permanent-local t)
+
+(defvar notmuch-show-process-crypto nil)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -411,14 +427,11 @@ message at DEPTH in the current thread."
 
 (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
   (declare (indent 2))
-  (let ((process-crypto (make-symbol "process-crypto")))
-    `(let ((,process-crypto notmuch-show-process-crypto))
-       (with-temp-buffer
-	 (setq notmuch-show-process-crypto ,process-crypto)
-	 ;; Always acquires the part via `notmuch part', even if it is
-	 ;; available in the JSON output.
-	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
-	 ,@body))))
+  `(with-temp-buffer
+     ;; Always acquires the part via `notmuch part', even if it is
+     ;; available in the JSON output.
+     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
+     ,@body))
 
 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
   (notmuch-with-temp-part-buffer message-id nth
@@ -600,7 +613,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -626,7 +639,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -753,8 +766,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -908,6 +919,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -923,15 +943,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -951,7 +962,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -966,46 +977,41 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    ;; Set the default value for `notmuch-show-process-crypto' in this
+    ;; buffer.
+    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+
+    (setq notmuch-show-thread-id thread-id
+	  notmuch-show-parent-buffer parent-buffer
+	  notmuch-show-query-context query-context)
+    (notmuch-show-worker)))
+
+(defun notmuch-show-worker ()
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
 
-    (setq notmuch-show-thread-id thread-id)
-    (setq notmuch-show-parent-buffer parent-buffer)
-    (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
-
     (erase-buffer)
     (goto-char (point-min))
     (save-excursion
-      (let* ((basic-args (list thread-id))
-	     (args (if query-context
-		       (append (list "\'") basic-args (list "and (" query-context ")\'"))
+      (let* ((basic-args (list notmuch-show-thread-id))
+	     (args (if notmuch-show-query-context
+		       (append (list "\'") basic-args
+			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'")))))
 	(notmuch-show-insert-forest (notmuch-query-get-threads args))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
 	(when (and (eq (buffer-size) 0)
-		   query-context)
+		   notmuch-show-query-context)
 	  (notmuch-show-insert-forest
 	   (notmuch-query-get-threads basic-args))))
 
@@ -1022,21 +1028,14 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1087,6 +1086,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 72f78ed..9d8bebd 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -463,9 +463,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-search-find-subject)))
     (if (> (length thread-id) 0)
@@ -479,8 +479,7 @@ Complete list of currently available key bindings:
 			 (concat "*"
 				 (truncate-string-to-width subject 32 nil nil t)
 				 "*")
-			 32 nil nil t))
-		      crypto-switch)
+			 32 nil nil t)))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-02-02 11:23   ` [PATCH v6 1/8] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b6329d2..df81cd1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -141,6 +141,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -928,11 +932,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1086,6 +1101,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 3/8] emacs: Allow the indentation of content to be toggled.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-02-02 11:23   ` [PATCH v6 1/8] emacs: Rework crypto switch toggle David Edmondson
  2012-02-02 11:23   ` [PATCH v6 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

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 df81cd1..a07a44a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -145,6 +145,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
@@ -255,10 +259,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)
@@ -886,7 +892,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"))
@@ -894,7 +901,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))
 
@@ -941,6 +949,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))
@@ -1103,6 +1120,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 4/8] emacs: Add a binding (t) to toggle the truncation of long lines.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (2 preceding siblings ...)
  2012-02-02 11:23   ` [PATCH v6 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a07a44a..8d318c9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1121,6 +1121,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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)
+	(define-key map "t" 'toggle-truncate-lines)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (3 preceding siblings ...)
  2012-02-02 11:23   ` [PATCH v6 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

With an argument, record and reply the state of the buffer during
`notmuch-show-refresh-view'.

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.

Traditional use of refresh with the = key does not retain the
state. The recently introduced toggle commands ($, !, < and >) do
retain the state.
---
 emacs/notmuch-show.el |   56 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8d318c9..1b31166 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -938,7 +938,7 @@ current buffer, if possible."
   (message (if notmuch-show-process-crypto
 	       "Processing cryptographic MIME parts."
 	     "Not processing cryptographic MIME parts."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-elide-non-matching ()
   "Toggle the display of non-matching messages."
@@ -947,7 +947,7 @@ current buffer, if possible."
   (message (if notmuch-show-elide-non-matching-messages
 	       "Showing matching messages only."
 	     "Showing all messages."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-thread-indentation ()
   "Toggle the indentation of threads."
@@ -956,7 +956,7 @@ current buffer, if possible."
   (message (if notmuch-show-indent-content
 	       "Content is indented."
 	     "Content is not indented."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-insert-tree (tree depth)
   "Insert the message tree TREE at depth DEPTH in the current thread."
@@ -1060,14 +1060,54 @@ function is used."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view ()
+(defun notmuch-show-capture-state ()
+  "Capture the state of the current buffer.
+
+This includes:
+ - the list of open messages,
+ - the current message."
+  (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
+
+(defun notmuch-show-apply-state (state)
+  "Apply STATE to the current buffer.
+
+This includes:
+ - opening the messages previously opened,
+ - closing all other messages,
+ - moving to the correct current message."
+  (let ((current (car state))
+	(open (cadr state)))
+
+    ;; Open those that were open.
+    (goto-char (point-min))
+    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+					   (member (notmuch-show-get-message-id) open))
+	  until (not (notmuch-show-goto-message-next)))
+
+    ;; Go to the previously open message.
+    (goto-char (point-min))
+    (unless (loop if (string= current (notmuch-show-get-message-id))
+		  return t
+		  until (not (notmuch-show-goto-message-next)))
+      (goto-char (point-min))
+      (message "Previously current message not found."))
+    (notmuch-show-message-adjust)))
+
+(defun notmuch-show-refresh-view (&optional retain-state)
   "Refresh the current view.
 
-Refreshes the current view, observing changes in cryptographic preferences."
+Refreshes the current view, observing changes in display
+preferences. If RETAIN-STATE is non-nil then the state of the
+buffer is stored and re-applied after the refresh."
   (interactive)
-  (let ((inhibit-read-only t))
-    (erase-buffer))
-  (notmuch-show-worker))
+  (let ((inhibit-read-only t)
+	state)
+    (if retain-state
+	(setq state (notmuch-show-capture-state)))
+    (erase-buffer)
+    (notmuch-show-worker)
+    (if state
+	(notmuch-show-apply-state state))))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 6/8] emacs: Check that the parent buffer is alive before using it.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (4 preceding siblings ...)
  2012-02-02 11:23   ` [PATCH v6 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
  2012-02-02 11:23   ` [PATCH v6 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1b31166..895feb5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1671,7 +1671,7 @@ added."
   (interactive "P")
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
-    (when parent-buffer
+    (when (buffer-live-p parent-buffer)
       (switch-to-buffer parent-buffer)
       (notmuch-search-next-thread)
       (if show-next
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 7/8] emacs: Add `notmuch-show-only-matching-messages'.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (5 preceding siblings ...)
  2012-02-02 11:23   ` [PATCH v6 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  2012-02-02 11:23   ` [PATCH v6 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

Allow the user to choose that only matching messages are shown by
default.
---
 emacs/notmuch-show.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 895feb5..ae7af02 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,11 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defcustom notmuch-show-only-matching-messages nil
+  "Only matching messages are shown by default."
+  :type 'boolean
+  :group 'notmuch-show)
+
 (defvar notmuch-show-thread-id nil)
 (make-variable-buffer-local 'notmuch-show-thread-id)
 (put 'notmuch-show-thread-id 'permanent-local t)
@@ -1018,6 +1023,9 @@ function is used."
     ;; Set the default value for `notmuch-show-process-crypto' in this
     ;; buffer.
     (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+    ;; Set the default value for
+    ;; `notmuch-show-elide-non-matching-messages' in this buffer.
+    (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v6 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour.
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (6 preceding siblings ...)
  2012-02-02 11:23   ` [PATCH v6 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
@ 2012-02-02 11:23   ` David Edmondson
  7 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-02 11:23 UTC (permalink / raw)
  To: notmuch

Allow the user to open a thread with inverted
`notmuch-show-only-matching-messages' behaviour using a prefix
argument.
---
 emacs/notmuch-show.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ae7af02..e9aa4e7 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1024,8 +1024,11 @@ function is used."
     ;; buffer.
     (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
     ;; Set the default value for
-    ;; `notmuch-show-elide-non-matching-messages' in this buffer.
+    ;; `notmuch-show-elide-non-matching-messages' in this buffer. If
+    ;; there is a prefix argument, invert the default.
     (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
+    (if current-prefix-arg
+	(setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages)))
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v6 1/8] emacs: Rework crypto switch toggle.
  2012-02-02 11:23   ` [PATCH v6 1/8] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-03 10:47     ` David Edmondson
  0 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-03 10:47 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

On Thu,  2 Feb 2012 11:23:46 +0000, David Edmondson <dme@dme.org> wrote:
> Re-work the existing crypto switch toggle to be based on a persistant
> buffer-local variable.
> 
> To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
> in the current buffer rather than killing the current buffer and
> creating a new one. (This will also allow more per-buffer behaviour in
> future patches.)
> 
> Add a binding ('$') to toggle crypto processing of the current buffer
> and remove the prefix argument approach that achieves a similar
> result.

Any chance of a reviewer for this piece?

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (7 preceding siblings ...)
  2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-02-06  9:21 ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 1/8] emacs: Rework crypto switch toggle David Edmondson
                     ` (8 more replies)
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
  9 siblings, 9 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

v7:
- Simple rebase.

David Edmondson (8):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.
  emacs: Add a binding (t) to toggle the truncation of long lines.
  emacs: Optionally retain the state of the buffer during
    `notmuch-show-refresh-view'.
  emacs: Check that the parent buffer is alive before using it.
  emacs: Add `notmuch-show-only-matching-messages'.
  emacs: A prefix argument to `notmuch-show' should invert the matching
        message behaviour.

 emacs/notmuch-show.el |  224 ++++++++++++++++++++++++++++++++++---------------
 emacs/notmuch.el      |    7 +-
 2 files changed, 158 insertions(+), 73 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v7 1/8] emacs: Rework crypto switch toggle.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-08  5:10     ` Austin Clements
  2012-02-06  9:21   ` [PATCH v7 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
                     ` (7 subsequent siblings)
  8 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  126 ++++++++++++++++++++++++------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 66 insertions(+), 67 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7469e2e..4b29dbd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,22 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(put 'notmuch-show-thread-id 'permanent-local t)
+
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(put 'notmuch-show-parent-buffer 'permanent-local t)
+
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+(put 'notmuch-show-query-context 'permanent-local t)
+
+(defvar notmuch-show-process-crypto nil)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -421,14 +437,11 @@ message at DEPTH in the current thread."
 
 (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
   (declare (indent 2))
-  (let ((process-crypto (make-symbol "process-crypto")))
-    `(let ((,process-crypto notmuch-show-process-crypto))
-       (with-temp-buffer
-	 (setq notmuch-show-process-crypto ,process-crypto)
-	 ;; Always acquires the part via `notmuch part', even if it is
-	 ;; available in the JSON output.
-	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
-	 ,@body))))
+  `(with-temp-buffer
+     ;; Always acquires the part via `notmuch part', even if it is
+     ;; available in the JSON output.
+     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
+     ,@body))
 
 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
   (notmuch-with-temp-part-buffer message-id nth
@@ -610,7 +623,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -636,7 +649,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -763,8 +776,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -918,6 +929,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -933,15 +953,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -961,7 +972,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -976,46 +987,41 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    ;; Set the default value for `notmuch-show-process-crypto' in this
+    ;; buffer.
+    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+
+    (setq notmuch-show-thread-id thread-id
+	  notmuch-show-parent-buffer parent-buffer
+	  notmuch-show-query-context query-context)
+    (notmuch-show-worker)))
+
+(defun notmuch-show-worker ()
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
 
-    (setq notmuch-show-thread-id thread-id)
-    (setq notmuch-show-parent-buffer parent-buffer)
-    (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
-
     (erase-buffer)
     (goto-char (point-min))
     (save-excursion
-      (let* ((basic-args (list thread-id))
-	     (args (if query-context
-		       (append (list "\'") basic-args (list "and (" query-context ")\'"))
+      (let* ((basic-args (list notmuch-show-thread-id))
+	     (args (if notmuch-show-query-context
+		       (append (list "\'") basic-args
+			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'")))))
 	(notmuch-show-insert-forest (notmuch-query-get-threads args))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
 	(when (and (eq (buffer-size) 0)
-		   query-context)
+		   notmuch-show-query-context)
 	  (notmuch-show-insert-forest
 	   (notmuch-query-get-threads basic-args))))
 
@@ -1032,21 +1038,14 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1097,6 +1096,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index cd04ffd..ff0db99 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -463,9 +463,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-prettify-subject (notmuch-search-find-subject))))
     (if (> (length thread-id) 0)
@@ -473,8 +473,7 @@ Complete list of currently available key bindings:
 		      (current-buffer)
 		      notmuch-search-query-string
 		      ;; Name the buffer based on the subject.
-		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
-		      crypto-switch)
+		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*"))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-02-06  9:21   ` [PATCH v7 1/8] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4b29dbd..39f19d3 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -141,6 +141,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -938,11 +942,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1096,6 +1111,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 3/8] emacs: Allow the indentation of content to be toggled.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
  2012-02-06  9:21   ` [PATCH v7 1/8] emacs: Rework crypto switch toggle David Edmondson
  2012-02-06  9:21   ` [PATCH v7 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

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 39f19d3..89663ee 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -145,6 +145,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
@@ -255,10 +259,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)
@@ -896,7 +902,8 @@ current buffer, if possible."
     (setq body-start (point-marker))
     ;; A blank line between the headers and the body.
     (insert "\n")
-    (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"))
@@ -904,7 +911,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))
 
@@ -951,6 +959,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))
@@ -1113,6 +1130,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 4/8] emacs: Add a binding (t) to toggle the truncation of long lines.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (2 preceding siblings ...)
  2012-02-06  9:21   ` [PATCH v7 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 89663ee..db9292c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1131,6 +1131,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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)
+	(define-key map "t" 'toggle-truncate-lines)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (3 preceding siblings ...)
  2012-02-06  9:21   ` [PATCH v7 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

With an argument, record and reply the state of the buffer during
`notmuch-show-refresh-view'.

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.

Traditional use of refresh with the = key does not retain the
state. The recently introduced toggle commands ($, !, < and >) do
retain the state.
---
 emacs/notmuch-show.el |   56 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index db9292c..f23aa8d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -948,7 +948,7 @@ current buffer, if possible."
   (message (if notmuch-show-process-crypto
 	       "Processing cryptographic MIME parts."
 	     "Not processing cryptographic MIME parts."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-elide-non-matching ()
   "Toggle the display of non-matching messages."
@@ -957,7 +957,7 @@ current buffer, if possible."
   (message (if notmuch-show-elide-non-matching-messages
 	       "Showing matching messages only."
 	     "Showing all messages."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-thread-indentation ()
   "Toggle the indentation of threads."
@@ -966,7 +966,7 @@ current buffer, if possible."
   (message (if notmuch-show-indent-content
 	       "Content is indented."
 	     "Content is not indented."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-insert-tree (tree depth)
   "Insert the message tree TREE at depth DEPTH in the current thread."
@@ -1070,14 +1070,54 @@ function is used."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view ()
+(defun notmuch-show-capture-state ()
+  "Capture the state of the current buffer.
+
+This includes:
+ - the list of open messages,
+ - the current message."
+  (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
+
+(defun notmuch-show-apply-state (state)
+  "Apply STATE to the current buffer.
+
+This includes:
+ - opening the messages previously opened,
+ - closing all other messages,
+ - moving to the correct current message."
+  (let ((current (car state))
+	(open (cadr state)))
+
+    ;; Open those that were open.
+    (goto-char (point-min))
+    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+					   (member (notmuch-show-get-message-id) open))
+	  until (not (notmuch-show-goto-message-next)))
+
+    ;; Go to the previously open message.
+    (goto-char (point-min))
+    (unless (loop if (string= current (notmuch-show-get-message-id))
+		  return t
+		  until (not (notmuch-show-goto-message-next)))
+      (goto-char (point-min))
+      (message "Previously current message not found."))
+    (notmuch-show-message-adjust)))
+
+(defun notmuch-show-refresh-view (&optional retain-state)
   "Refresh the current view.
 
-Refreshes the current view, observing changes in cryptographic preferences."
+Refreshes the current view, observing changes in display
+preferences. If RETAIN-STATE is non-nil then the state of the
+buffer is stored and re-applied after the refresh."
   (interactive)
-  (let ((inhibit-read-only t))
-    (erase-buffer))
-  (notmuch-show-worker))
+  (let ((inhibit-read-only t)
+	state)
+    (if retain-state
+	(setq state (notmuch-show-capture-state)))
+    (erase-buffer)
+    (notmuch-show-worker)
+    (if state
+	(notmuch-show-apply-state state))))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 6/8] emacs: Check that the parent buffer is alive before using it.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (4 preceding siblings ...)
  2012-02-06  9:21   ` [PATCH v7 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f23aa8d..ec36767 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1683,7 +1683,7 @@ added."
   (interactive "P")
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
-    (when parent-buffer
+    (when (buffer-live-p parent-buffer)
       (switch-to-buffer parent-buffer)
       (notmuch-search-next-thread)
       (if show-next
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 7/8] emacs: Add `notmuch-show-only-matching-messages'.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (5 preceding siblings ...)
  2012-02-06  9:21   ` [PATCH v7 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06  9:21   ` [PATCH v7 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
  2012-02-06 11:32   ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles Tomi Ollila
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

Allow the user to choose that only matching messages are shown by
default.
---
 emacs/notmuch-show.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ec36767..8c24f38 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,11 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defcustom notmuch-show-only-matching-messages nil
+  "Only matching messages are shown by default."
+  :type 'boolean
+  :group 'notmuch-show)
+
 (defvar notmuch-show-thread-id nil)
 (make-variable-buffer-local 'notmuch-show-thread-id)
 (put 'notmuch-show-thread-id 'permanent-local t)
@@ -1028,6 +1033,9 @@ function is used."
     ;; Set the default value for `notmuch-show-process-crypto' in this
     ;; buffer.
     (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+    ;; Set the default value for
+    ;; `notmuch-show-elide-non-matching-messages' in this buffer.
+    (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v7 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour.
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (6 preceding siblings ...)
  2012-02-06  9:21   ` [PATCH v7 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
@ 2012-02-06  9:21   ` David Edmondson
  2012-02-06 11:32   ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles Tomi Ollila
  8 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-06  9:21 UTC (permalink / raw)
  To: notmuch

Allow the user to open a thread with inverted
`notmuch-show-only-matching-messages' behaviour using a prefix
argument.
---
 emacs/notmuch-show.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8c24f38..9c1d8fc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1034,8 +1034,11 @@ function is used."
     ;; buffer.
     (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
     ;; Set the default value for
-    ;; `notmuch-show-elide-non-matching-messages' in this buffer.
+    ;; `notmuch-show-elide-non-matching-messages' in this buffer. If
+    ;; there is a prefix argument, invert the default.
     (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
+    (if current-prefix-arg
+	(setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages)))
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (7 preceding siblings ...)
  2012-02-06  9:21   ` [PATCH v7 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
@ 2012-02-06 11:32   ` Tomi Ollila
  8 siblings, 0 replies; 87+ messages in thread
From: Tomi Ollila @ 2012-02-06 11:32 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Mon,  6 Feb 2012 09:21:14 +0000, David Edmondson <dme@dme.org> wrote:
> v7:
> - Simple rebase.

The whole patch series applied cleanly (git am) on top of current origin/master
+ Dmitry's patchset id:"1328426033-21480-2-git-send-email-dmitry.kurochkin@gmail.com"

> David Edmondson (8):
>   emacs: Rework crypto switch toggle.

I don't currently have any data (on this particular machine) to test 
crypto switch toggle. Rest of the patches (2-8) worked fine.

So, +1 for those. 

Tomi

>   emacs: Allow `notmuch-show-mode' to display only matching messages.
>   emacs: Allow the indentation of content to be toggled.
>   emacs: Add a binding (t) to toggle the truncation of long lines.
>   emacs: Optionally retain the state of the buffer during
>     `notmuch-show-refresh-view'.
>   emacs: Check that the parent buffer is alive before using it.
>   emacs: Add `notmuch-show-only-matching-messages'.
>   emacs: A prefix argument to `notmuch-show' should invert the matching
>         message behaviour.
> 
>  emacs/notmuch-show.el |  224 ++++++++++++++++++++++++++++++++++---------------
>  emacs/notmuch.el      |    7 +-
>  2 files changed, 158 insertions(+), 73 deletions(-)

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v7 1/8] emacs: Rework crypto switch toggle.
  2012-02-06  9:21   ` [PATCH v7 1/8] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-08  5:10     ` Austin Clements
  2012-02-08  6:21       ` David Edmondson
  0 siblings, 1 reply; 87+ messages in thread
From: Austin Clements @ 2012-02-08  5:10 UTC (permalink / raw)
  To: David Edmondson; +Cc: notmuch

Seems reasonable.  I'm definitely in favor of erasing buffers instead
of killing and recreating them.  Two questions below.

Quoth David Edmondson on Feb 06 at  9:21 am:
> Re-work the existing crypto switch toggle to be based on a persistant
> buffer-local variable.
> 
> To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
> in the current buffer rather than killing the current buffer and
> creating a new one. (This will also allow more per-buffer behaviour in
> future patches.)
> 
> Add a binding ('$') to toggle crypto processing of the current buffer
> and remove the prefix argument approach that achieves a similar
> result.
> ---
>  emacs/notmuch-show.el |  126 ++++++++++++++++++++++++------------------------
>  emacs/notmuch.el      |    7 +--
>  2 files changed, 66 insertions(+), 67 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 7469e2e..4b29dbd 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -125,6 +125,22 @@ indentation."
>  		 (const :tag "View interactively"
>  			notmuch-show-interactively-view-part)))
>  
> +(defvar notmuch-show-thread-id nil)
> +(make-variable-buffer-local 'notmuch-show-thread-id)
> +(put 'notmuch-show-thread-id 'permanent-local t)
> +
> +(defvar notmuch-show-parent-buffer nil)
> +(make-variable-buffer-local 'notmuch-show-parent-buffer)
> +(put 'notmuch-show-parent-buffer 'permanent-local t)
> +
> +(defvar notmuch-show-query-context nil)
> +(make-variable-buffer-local 'notmuch-show-query-context)
> +(put 'notmuch-show-query-context 'permanent-local t)
> +
> +(defvar notmuch-show-process-crypto nil)
> +(make-variable-buffer-local 'notmuch-show-process-crypto)
> +(put 'notmuch-show-process-crypto 'permanent-local t)
> +

Do these need to be permanent-local given that refreshing is now done
by erasing the buffer instead of killing it?

>  (defmacro with-current-notmuch-show-message (&rest body)
>    "Evaluate body with current buffer set to the text of current message"
>    `(save-excursion
> @@ -421,14 +437,11 @@ message at DEPTH in the current thread."
>  
>  (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
>    (declare (indent 2))
> -  (let ((process-crypto (make-symbol "process-crypto")))
> -    `(let ((,process-crypto notmuch-show-process-crypto))
> -       (with-temp-buffer
> -	 (setq notmuch-show-process-crypto ,process-crypto)
> -	 ;; Always acquires the part via `notmuch part', even if it is
> -	 ;; available in the JSON output.
> -	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
> -	 ,@body))))
> +  `(with-temp-buffer
> +     ;; Always acquires the part via `notmuch part', even if it is
> +     ;; available in the JSON output.
> +     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
> +     ,@body))

Why is the piping of notmuch-show-process-crypto no longer necessary?
It's still buffer-local, and hence will be nil in the temp buffer.

>  
>  (defun notmuch-show-save-part (message-id nth &optional filename content-type)
>    (notmuch-with-temp-part-buffer message-id nth
> @@ -610,7 +623,7 @@ current buffer, if possible."
>  	       (sigstatus (car (plist-get part :sigstatus))))
>  	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
>        ;; if we're not adding sigstatus, tell the user how they can get it
> -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
> +      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
>  
>    (let ((inner-parts (plist-get part :content))
>  	(start (point)))
> @@ -636,7 +649,7 @@ current buffer, if possible."
>  		     (sigstatus (car (plist-get part :sigstatus))))
>  		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
>        ;; if we're not adding encstatus, tell the user how they can get it
> -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
> +      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
>  
>    (let ((inner-parts (plist-get part :content))
>  	(start (point)))
> @@ -763,8 +776,6 @@ current buffer, if possible."
>  
>  ;; Helper for parts which are generally not included in the default
>  ;; JSON output.
> -;; Uses the buffer-local variable notmuch-show-process-crypto to
> -;; determine if parts should be decrypted first.
>  (defun notmuch-show-get-bodypart-internal (message-id part-number)
>    (let ((args '("show" "--format=raw"))
>  	(part-arg (format "--part=%s" part-number)))
> @@ -918,6 +929,15 @@ current buffer, if possible."
>      ;; criteria.
>      (notmuch-show-message-visible msg (plist-get msg :match))))
>  
> +(defun notmuch-show-toggle-process-crypto ()
> +  "Toggle the processing of cryptographic MIME parts."
> +  (interactive)
> +  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
> +  (message (if notmuch-show-process-crypto
> +	       "Processing cryptographic MIME parts."
> +	     "Not processing cryptographic MIME parts."))
> +  (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))
> @@ -933,15 +953,6 @@ current buffer, if possible."
>    "Insert the forest of threads FOREST."
>    (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
>  
> -(defvar notmuch-show-thread-id nil)
> -(make-variable-buffer-local 'notmuch-show-thread-id)
> -(defvar notmuch-show-parent-buffer nil)
> -(make-variable-buffer-local 'notmuch-show-parent-buffer)
> -(defvar notmuch-show-query-context nil)
> -(make-variable-buffer-local 'notmuch-show-query-context)
> -(defvar notmuch-show-buffer-name nil)
> -(make-variable-buffer-local 'notmuch-show-buffer-name)
> -
>  (defun notmuch-show-buttonise-links (start end)
>    "Buttonise URLs and mail addresses between START and END.
>  
> @@ -961,7 +972,7 @@ a corresponding notmuch search."
>  			'face goto-address-mail-face))))
>  
>  ;;;###autoload
> -(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
> +(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
>    "Run \"notmuch show\" with the given thread ID and display results.
>  
>  The optional PARENT-BUFFER is the notmuch-search buffer from
> @@ -976,46 +987,41 @@ non-nil.
>  The optional BUFFER-NAME provides the name of the buffer in
>  which the message thread is shown. If it is nil (which occurs
>  when the command is called interactively) the argument to the
> -function is used.
> -
> -The optional CRYPTO-SWITCH toggles the value of the
> -notmuch-crypto-process-mime customization variable for this show
> -buffer."
> +function is used."
>    (interactive "sNotmuch show: ")
> -  (let* ((process-crypto (if crypto-switch
> -			     (not notmuch-crypto-process-mime)
> -			   notmuch-crypto-process-mime)))
> -    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
> -
> -(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
> -  (let* ((buffer-name (generate-new-buffer-name
> -		       (or buffer-name
> -			   (concat "*notmuch-" thread-id "*"))))
> -	 (buffer (get-buffer-create buffer-name))
> -	 (inhibit-read-only t))
> -    (switch-to-buffer buffer)
> +  (let ((buffer-name (generate-new-buffer-name
> +		      (or buffer-name
> +			  (concat "*notmuch-" thread-id "*")))))
> +    (switch-to-buffer (get-buffer-create buffer-name))
> +    ;; Set the default value for `notmuch-show-process-crypto' in this
> +    ;; buffer.
> +    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
> +
> +    (setq notmuch-show-thread-id thread-id
> +	  notmuch-show-parent-buffer parent-buffer
> +	  notmuch-show-query-context query-context)
> +    (notmuch-show-worker)))
> +
> +(defun notmuch-show-worker ()
> +  (let ((inhibit-read-only t))
> +
>      (notmuch-show-mode)
>      ;; Don't track undo information for this buffer
>      (set 'buffer-undo-list t)
>  
> -    (setq notmuch-show-thread-id thread-id)
> -    (setq notmuch-show-parent-buffer parent-buffer)
> -    (setq notmuch-show-query-context query-context)
> -    (setq notmuch-show-buffer-name buffer-name)
> -    (setq notmuch-show-process-crypto process-crypto)
> -
>      (erase-buffer)
>      (goto-char (point-min))
>      (save-excursion
> -      (let* ((basic-args (list thread-id))
> -	     (args (if query-context
> -		       (append (list "\'") basic-args (list "and (" query-context ")\'"))
> +      (let* ((basic-args (list notmuch-show-thread-id))
> +	     (args (if notmuch-show-query-context
> +		       (append (list "\'") basic-args
> +			       (list "and (" notmuch-show-query-context ")\'"))
>  		     (append (list "\'") basic-args (list "\'")))))
>  	(notmuch-show-insert-forest (notmuch-query-get-threads args))
>  	;; If the query context reduced the results to nothing, run
>  	;; the basic query.
>  	(when (and (eq (buffer-size) 0)
> -		   query-context)
> +		   notmuch-show-query-context)
>  	  (notmuch-show-insert-forest
>  	   (notmuch-query-get-threads basic-args))))
>  
> @@ -1032,21 +1038,14 @@ buffer."
>  
>      (notmuch-show-mark-read)))
>  
> -(defun notmuch-show-refresh-view (&optional crypto-switch)
> -  "Refresh the current view (with crypto switch if prefix given).
> +(defun notmuch-show-refresh-view ()
> +  "Refresh the current view.
>  
> -Kills the current buffer and reruns notmuch show with the same
> -thread id.  If a prefix is given, crypto processing is toggled."
> -  (interactive "P")
> -  (let ((thread-id notmuch-show-thread-id)
> -	(parent-buffer notmuch-show-parent-buffer)
> -	(query-context notmuch-show-query-context)
> -	(buffer-name notmuch-show-buffer-name)
> -	(process-crypto (if crypto-switch
> -			    (not notmuch-show-process-crypto)
> -			  notmuch-show-process-crypto)))
> -    (notmuch-kill-this-buffer)
> -    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
> +Refreshes the current view, observing changes in cryptographic preferences."
> +  (interactive)
> +  (let ((inhibit-read-only t))
> +    (erase-buffer))
> +  (notmuch-show-worker))
>  
>  (defvar notmuch-show-stash-map
>    (let ((map (make-sparse-keymap)))
> @@ -1097,6 +1096,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
>  	(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-print-message)
> +	(define-key map "$" 'notmuch-show-toggle-process-crypto)
>  	map)
>        "Keymap for \"notmuch show\" buffers.")
>  (fset 'notmuch-show-mode-map notmuch-show-mode-map)
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index cd04ffd..ff0db99 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -463,9 +463,9 @@ Complete list of currently available key bindings:
>    "Return a list of authors for the current region"
>    (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
>  
> -(defun notmuch-search-show-thread (&optional crypto-switch)
> +(defun notmuch-search-show-thread ()
>    "Display the currently selected thread."
> -  (interactive "P")
> +  (interactive)
>    (let ((thread-id (notmuch-search-find-thread-id))
>  	(subject (notmuch-prettify-subject (notmuch-search-find-subject))))
>      (if (> (length thread-id) 0)
> @@ -473,8 +473,7 @@ Complete list of currently available key bindings:
>  		      (current-buffer)
>  		      notmuch-search-query-string
>  		      ;; Name the buffer based on the subject.
> -		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
> -		      crypto-switch)
> +		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*"))
>        (message "End of search results."))))
>  
>  (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v7 1/8] emacs: Rework crypto switch toggle.
  2012-02-08  5:10     ` Austin Clements
@ 2012-02-08  6:21       ` David Edmondson
  0 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  6:21 UTC (permalink / raw)
  To: Austin Clements; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 13170 bytes --]

On Wed, 8 Feb 2012 00:10:16 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> Seems reasonable.  I'm definitely in favor of erasing buffers instead
> of killing and recreating them.  Two questions below.

Thanks for the review.

> Quoth David Edmondson on Feb 06 at  9:21 am:
> > Re-work the existing crypto switch toggle to be based on a persistant
> > buffer-local variable.
> > 
> > To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
> > in the current buffer rather than killing the current buffer and
> > creating a new one. (This will also allow more per-buffer behaviour in
> > future patches.)
> > 
> > Add a binding ('$') to toggle crypto processing of the current buffer
> > and remove the prefix argument approach that achieves a similar
> > result.
> > ---
> >  emacs/notmuch-show.el |  126 ++++++++++++++++++++++++------------------------
> >  emacs/notmuch.el      |    7 +--
> >  2 files changed, 66 insertions(+), 67 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index 7469e2e..4b29dbd 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -125,6 +125,22 @@ indentation."
> >  		 (const :tag "View interactively"
> >  			notmuch-show-interactively-view-part)))
> >  
> > +(defvar notmuch-show-thread-id nil)
> > +(make-variable-buffer-local 'notmuch-show-thread-id)
> > +(put 'notmuch-show-thread-id 'permanent-local t)
> > +
> > +(defvar notmuch-show-parent-buffer nil)
> > +(make-variable-buffer-local 'notmuch-show-parent-buffer)
> > +(put 'notmuch-show-parent-buffer 'permanent-local t)
> > +
> > +(defvar notmuch-show-query-context nil)
> > +(make-variable-buffer-local 'notmuch-show-query-context)
> > +(put 'notmuch-show-query-context 'permanent-local t)
> > +
> > +(defvar notmuch-show-process-crypto nil)
> > +(make-variable-buffer-local 'notmuch-show-process-crypto)
> > +(put 'notmuch-show-process-crypto 'permanent-local t)
> > +
> 
> Do these need to be permanent-local given that refreshing is now done
> by erasing the buffer instead of killing it?

Yes. `notmuch-show-worker' (which does the refreshing) still calls
`notmuch-show-mode', which still calls `kill-all-local-variables'.

Tidying that is for another patch.

> >  (defmacro with-current-notmuch-show-message (&rest body)
> >    "Evaluate body with current buffer set to the text of current message"
> >    `(save-excursion
> > @@ -421,14 +437,11 @@ message at DEPTH in the current thread."
> >  
> >  (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body)
> >    (declare (indent 2))
> > -  (let ((process-crypto (make-symbol "process-crypto")))
> > -    `(let ((,process-crypto notmuch-show-process-crypto))
> > -       (with-temp-buffer
> > -	 (setq notmuch-show-process-crypto ,process-crypto)
> > -	 ;; Always acquires the part via `notmuch part', even if it is
> > -	 ;; available in the JSON output.
> > -	 (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
> > -	 ,@body))))
> > +  `(with-temp-buffer
> > +     ;; Always acquires the part via `notmuch part', even if it is
> > +     ;; available in the JSON output.
> > +     (insert (notmuch-show-get-bodypart-internal ,message-id ,nth))
> > +     ,@body))
> 
> Why is the piping of notmuch-show-process-crypto no longer necessary?
> It's still buffer-local, and hence will be nil in the temp buffer.

It's a bug. v8 after breakfast.

> >  
> >  (defun notmuch-show-save-part (message-id nth &optional filename content-type)
> >    (notmuch-with-temp-part-buffer message-id nth
> > @@ -610,7 +623,7 @@ current buffer, if possible."
> >  	       (sigstatus (car (plist-get part :sigstatus))))
> >  	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
> >        ;; if we're not adding sigstatus, tell the user how they can get it
> > -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
> > +      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
> >  
> >    (let ((inner-parts (plist-get part :content))
> >  	(start (point)))
> > @@ -636,7 +649,7 @@ current buffer, if possible."
> >  		     (sigstatus (car (plist-get part :sigstatus))))
> >  		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
> >        ;; if we're not adding encstatus, tell the user how they can get it
> > -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
> > +      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
> >  
> >    (let ((inner-parts (plist-get part :content))
> >  	(start (point)))
> > @@ -763,8 +776,6 @@ current buffer, if possible."
> >  
> >  ;; Helper for parts which are generally not included in the default
> >  ;; JSON output.
> > -;; Uses the buffer-local variable notmuch-show-process-crypto to
> > -;; determine if parts should be decrypted first.
> >  (defun notmuch-show-get-bodypart-internal (message-id part-number)
> >    (let ((args '("show" "--format=raw"))
> >  	(part-arg (format "--part=%s" part-number)))
> > @@ -918,6 +929,15 @@ current buffer, if possible."
> >      ;; criteria.
> >      (notmuch-show-message-visible msg (plist-get msg :match))))
> >  
> > +(defun notmuch-show-toggle-process-crypto ()
> > +  "Toggle the processing of cryptographic MIME parts."
> > +  (interactive)
> > +  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
> > +  (message (if notmuch-show-process-crypto
> > +	       "Processing cryptographic MIME parts."
> > +	     "Not processing cryptographic MIME parts."))
> > +  (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))
> > @@ -933,15 +953,6 @@ current buffer, if possible."
> >    "Insert the forest of threads FOREST."
> >    (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
> >  
> > -(defvar notmuch-show-thread-id nil)
> > -(make-variable-buffer-local 'notmuch-show-thread-id)
> > -(defvar notmuch-show-parent-buffer nil)
> > -(make-variable-buffer-local 'notmuch-show-parent-buffer)
> > -(defvar notmuch-show-query-context nil)
> > -(make-variable-buffer-local 'notmuch-show-query-context)
> > -(defvar notmuch-show-buffer-name nil)
> > -(make-variable-buffer-local 'notmuch-show-buffer-name)
> > -
> >  (defun notmuch-show-buttonise-links (start end)
> >    "Buttonise URLs and mail addresses between START and END.
> >  
> > @@ -961,7 +972,7 @@ a corresponding notmuch search."
> >  			'face goto-address-mail-face))))
> >  
> >  ;;;###autoload
> > -(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
> > +(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
> >    "Run \"notmuch show\" with the given thread ID and display results.
> >  
> >  The optional PARENT-BUFFER is the notmuch-search buffer from
> > @@ -976,46 +987,41 @@ non-nil.
> >  The optional BUFFER-NAME provides the name of the buffer in
> >  which the message thread is shown. If it is nil (which occurs
> >  when the command is called interactively) the argument to the
> > -function is used.
> > -
> > -The optional CRYPTO-SWITCH toggles the value of the
> > -notmuch-crypto-process-mime customization variable for this show
> > -buffer."
> > +function is used."
> >    (interactive "sNotmuch show: ")
> > -  (let* ((process-crypto (if crypto-switch
> > -			     (not notmuch-crypto-process-mime)
> > -			   notmuch-crypto-process-mime)))
> > -    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
> > -
> > -(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
> > -  (let* ((buffer-name (generate-new-buffer-name
> > -		       (or buffer-name
> > -			   (concat "*notmuch-" thread-id "*"))))
> > -	 (buffer (get-buffer-create buffer-name))
> > -	 (inhibit-read-only t))
> > -    (switch-to-buffer buffer)
> > +  (let ((buffer-name (generate-new-buffer-name
> > +		      (or buffer-name
> > +			  (concat "*notmuch-" thread-id "*")))))
> > +    (switch-to-buffer (get-buffer-create buffer-name))
> > +    ;; Set the default value for `notmuch-show-process-crypto' in this
> > +    ;; buffer.
> > +    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
> > +
> > +    (setq notmuch-show-thread-id thread-id
> > +	  notmuch-show-parent-buffer parent-buffer
> > +	  notmuch-show-query-context query-context)
> > +    (notmuch-show-worker)))
> > +
> > +(defun notmuch-show-worker ()
> > +  (let ((inhibit-read-only t))
> > +
> >      (notmuch-show-mode)
> >      ;; Don't track undo information for this buffer
> >      (set 'buffer-undo-list t)
> >  
> > -    (setq notmuch-show-thread-id thread-id)
> > -    (setq notmuch-show-parent-buffer parent-buffer)
> > -    (setq notmuch-show-query-context query-context)
> > -    (setq notmuch-show-buffer-name buffer-name)
> > -    (setq notmuch-show-process-crypto process-crypto)
> > -
> >      (erase-buffer)
> >      (goto-char (point-min))
> >      (save-excursion
> > -      (let* ((basic-args (list thread-id))
> > -	     (args (if query-context
> > -		       (append (list "\'") basic-args (list "and (" query-context ")\'"))
> > +      (let* ((basic-args (list notmuch-show-thread-id))
> > +	     (args (if notmuch-show-query-context
> > +		       (append (list "\'") basic-args
> > +			       (list "and (" notmuch-show-query-context ")\'"))
> >  		     (append (list "\'") basic-args (list "\'")))))
> >  	(notmuch-show-insert-forest (notmuch-query-get-threads args))
> >  	;; If the query context reduced the results to nothing, run
> >  	;; the basic query.
> >  	(when (and (eq (buffer-size) 0)
> > -		   query-context)
> > +		   notmuch-show-query-context)
> >  	  (notmuch-show-insert-forest
> >  	   (notmuch-query-get-threads basic-args))))
> >  
> > @@ -1032,21 +1038,14 @@ buffer."
> >  
> >      (notmuch-show-mark-read)))
> >  
> > -(defun notmuch-show-refresh-view (&optional crypto-switch)
> > -  "Refresh the current view (with crypto switch if prefix given).
> > +(defun notmuch-show-refresh-view ()
> > +  "Refresh the current view.
> >  
> > -Kills the current buffer and reruns notmuch show with the same
> > -thread id.  If a prefix is given, crypto processing is toggled."
> > -  (interactive "P")
> > -  (let ((thread-id notmuch-show-thread-id)
> > -	(parent-buffer notmuch-show-parent-buffer)
> > -	(query-context notmuch-show-query-context)
> > -	(buffer-name notmuch-show-buffer-name)
> > -	(process-crypto (if crypto-switch
> > -			    (not notmuch-show-process-crypto)
> > -			  notmuch-show-process-crypto)))
> > -    (notmuch-kill-this-buffer)
> > -    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
> > +Refreshes the current view, observing changes in cryptographic preferences."
> > +  (interactive)
> > +  (let ((inhibit-read-only t))
> > +    (erase-buffer))
> > +  (notmuch-show-worker))
> >  
> >  (defvar notmuch-show-stash-map
> >    (let ((map (make-sparse-keymap)))
> > @@ -1097,6 +1096,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
> >  	(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-print-message)
> > +	(define-key map "$" 'notmuch-show-toggle-process-crypto)
> >  	map)
> >        "Keymap for \"notmuch show\" buffers.")
> >  (fset 'notmuch-show-mode-map notmuch-show-mode-map)
> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> > index cd04ffd..ff0db99 100644
> > --- a/emacs/notmuch.el
> > +++ b/emacs/notmuch.el
> > @@ -463,9 +463,9 @@ Complete list of currently available key bindings:
> >    "Return a list of authors for the current region"
> >    (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
> >  
> > -(defun notmuch-search-show-thread (&optional crypto-switch)
> > +(defun notmuch-search-show-thread ()
> >    "Display the currently selected thread."
> > -  (interactive "P")
> > +  (interactive)
> >    (let ((thread-id (notmuch-search-find-thread-id))
> >  	(subject (notmuch-prettify-subject (notmuch-search-find-subject))))
> >      (if (> (length thread-id) 0)
> > @@ -473,8 +473,7 @@ Complete list of currently available key bindings:
> >  		      (current-buffer)
> >  		      notmuch-search-query-string
> >  		      ;; Name the buffer based on the subject.
> > -		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
> > -		      crypto-switch)
> > +		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*"))
> >        (message "End of search results."))))
> >  
> >  (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles
  2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
                   ` (8 preceding siblings ...)
  2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-02-08  8:02 ` David Edmondson
  2012-02-08  8:02   ` [PATCH v8 1/8] emacs: Rework crypto switch toggle David Edmondson
                     ` (12 more replies)
  9 siblings, 13 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

v8:
- Code review comments from Austin:
  - Correctly decrypt parts when saving, etc. them. (revert to
    original behaviour).

David Edmondson (8):
  emacs: Rework crypto switch toggle.
  emacs: Allow `notmuch-show-mode' to display only matching messages.
  emacs: Allow the indentation of content to be toggled.
  emacs: Add a binding (t) to toggle the truncation of long lines.
  emacs: Optionally retain the state of the buffer during
    `notmuch-show-refresh-view'.
  emacs: Check that the parent buffer is alive before using it.
  emacs: Add `notmuch-show-only-matching-messages'.
  emacs: A prefix argument to `notmuch-show' should invert the matching
        message behaviour.

 emacs/notmuch-show.el |  211 +++++++++++++++++++++++++++++++++++--------------
 emacs/notmuch.el      |    7 +-
 2 files changed, 153 insertions(+), 65 deletions(-)

-- 
1.7.8.3

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH v8 1/8] emacs: Rework crypto switch toggle.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08 14:38     ` Austin Clements
  2012-02-08  8:02   ` [PATCH v3 1/2] emacs: Use text properties rather than overlays in `notmuch-show-mode' David Edmondson
                     ` (11 subsequent siblings)
  12 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

Re-work the existing crypto switch toggle to be based on a persistant
buffer-local variable.

To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
in the current buffer rather than killing the current buffer and
creating a new one. (This will also allow more per-buffer behaviour in
future patches.)

Add a binding ('$') to toggle crypto processing of the current buffer
and remove the prefix argument approach that achieves a similar
result.
---
 emacs/notmuch-show.el |  113 +++++++++++++++++++++++++------------------------
 emacs/notmuch.el      |    7 +--
 2 files changed, 61 insertions(+), 59 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7469e2e..058913a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,22 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defvar notmuch-show-thread-id nil)
+(make-variable-buffer-local 'notmuch-show-thread-id)
+(put 'notmuch-show-thread-id 'permanent-local t)
+
+(defvar notmuch-show-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-show-parent-buffer)
+(put 'notmuch-show-parent-buffer 'permanent-local t)
+
+(defvar notmuch-show-query-context nil)
+(make-variable-buffer-local 'notmuch-show-query-context)
+(put 'notmuch-show-query-context 'permanent-local t)
+
+(defvar notmuch-show-process-crypto nil)
+(make-variable-buffer-local 'notmuch-show-process-crypto)
+(put 'notmuch-show-process-crypto '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
@@ -610,7 +626,7 @@ current buffer, if possible."
 	       (sigstatus (car (plist-get part :sigstatus))))
 	  (notmuch-crypto-insert-sigstatus-button sigstatus from))
       ;; if we're not adding sigstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -636,7 +652,7 @@ current buffer, if possible."
 		     (sigstatus (car (plist-get part :sigstatus))))
 		(notmuch-crypto-insert-sigstatus-button sigstatus from))))
       ;; if we're not adding encstatus, tell the user how they can get it
-      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -763,8 +779,6 @@ current buffer, if possible."
 
 ;; Helper for parts which are generally not included in the default
 ;; JSON output.
-;; Uses the buffer-local variable notmuch-show-process-crypto to
-;; determine if parts should be decrypted first.
 (defun notmuch-show-get-bodypart-internal (message-id part-number)
   (let ((args '("show" "--format=raw"))
 	(part-arg (format "--part=%s" part-number)))
@@ -918,6 +932,15 @@ current buffer, if possible."
     ;; criteria.
     (notmuch-show-message-visible msg (plist-get msg :match))))
 
+(defun notmuch-show-toggle-process-crypto ()
+  "Toggle the processing of cryptographic MIME parts."
+  (interactive)
+  (setq notmuch-show-process-crypto (not notmuch-show-process-crypto))
+  (message (if notmuch-show-process-crypto
+	       "Processing cryptographic MIME parts."
+	     "Not processing cryptographic MIME parts."))
+  (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))
@@ -933,15 +956,6 @@ current buffer, if possible."
   "Insert the forest of threads FOREST."
   (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest))
 
-(defvar notmuch-show-thread-id nil)
-(make-variable-buffer-local 'notmuch-show-thread-id)
-(defvar notmuch-show-parent-buffer nil)
-(make-variable-buffer-local 'notmuch-show-parent-buffer)
-(defvar notmuch-show-query-context nil)
-(make-variable-buffer-local 'notmuch-show-query-context)
-(defvar notmuch-show-buffer-name nil)
-(make-variable-buffer-local 'notmuch-show-buffer-name)
-
 (defun notmuch-show-buttonise-links (start end)
   "Buttonise URLs and mail addresses between START and END.
 
@@ -961,7 +975,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -976,46 +990,41 @@ non-nil.
 The optional BUFFER-NAME provides the name of the buffer in
 which the message thread is shown. If it is nil (which occurs
 when the command is called interactively) the argument to the
-function is used.
-
-The optional CRYPTO-SWITCH toggles the value of the
-notmuch-crypto-process-mime customization variable for this show
-buffer."
+function is used."
   (interactive "sNotmuch show: ")
-  (let* ((process-crypto (if crypto-switch
-			     (not notmuch-crypto-process-mime)
-			   notmuch-crypto-process-mime)))
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
-
-(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)
-  (let* ((buffer-name (generate-new-buffer-name
-		       (or buffer-name
-			   (concat "*notmuch-" thread-id "*"))))
-	 (buffer (get-buffer-create buffer-name))
-	 (inhibit-read-only t))
-    (switch-to-buffer buffer)
+  (let ((buffer-name (generate-new-buffer-name
+		      (or buffer-name
+			  (concat "*notmuch-" thread-id "*")))))
+    (switch-to-buffer (get-buffer-create buffer-name))
+    ;; Set the default value for `notmuch-show-process-crypto' in this
+    ;; buffer.
+    (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+
+    (setq notmuch-show-thread-id thread-id
+	  notmuch-show-parent-buffer parent-buffer
+	  notmuch-show-query-context query-context)
+    (notmuch-show-worker)))
+
+(defun notmuch-show-worker ()
+  (let ((inhibit-read-only t))
+
     (notmuch-show-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
 
-    (setq notmuch-show-thread-id thread-id)
-    (setq notmuch-show-parent-buffer parent-buffer)
-    (setq notmuch-show-query-context query-context)
-    (setq notmuch-show-buffer-name buffer-name)
-    (setq notmuch-show-process-crypto process-crypto)
-
     (erase-buffer)
     (goto-char (point-min))
     (save-excursion
-      (let* ((basic-args (list thread-id))
-	     (args (if query-context
-		       (append (list "\'") basic-args (list "and (" query-context ")\'"))
+      (let* ((basic-args (list notmuch-show-thread-id))
+	     (args (if notmuch-show-query-context
+		       (append (list "\'") basic-args
+			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'")))))
 	(notmuch-show-insert-forest (notmuch-query-get-threads args))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
 	(when (and (eq (buffer-size) 0)
-		   query-context)
+		   notmuch-show-query-context)
 	  (notmuch-show-insert-forest
 	   (notmuch-query-get-threads basic-args))))
 
@@ -1032,21 +1041,14 @@ buffer."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view (&optional crypto-switch)
-  "Refresh the current view (with crypto switch if prefix given).
+(defun notmuch-show-refresh-view ()
+  "Refresh the current view.
 
-Kills the current buffer and reruns notmuch show with the same
-thread id.  If a prefix is given, crypto processing is toggled."
-  (interactive "P")
-  (let ((thread-id notmuch-show-thread-id)
-	(parent-buffer notmuch-show-parent-buffer)
-	(query-context notmuch-show-query-context)
-	(buffer-name notmuch-show-buffer-name)
-	(process-crypto (if crypto-switch
-			    (not notmuch-show-process-crypto)
-			  notmuch-show-process-crypto)))
-    (notmuch-kill-this-buffer)
-    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
+Refreshes the current view, observing changes in cryptographic preferences."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (erase-buffer))
+  (notmuch-show-worker))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
@@ -1097,6 +1099,7 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(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-print-message)
+	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index cd04ffd..ff0db99 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -463,9 +463,9 @@ Complete list of currently available key bindings:
   "Return a list of authors for the current region"
   (notmuch-search-properties-in-region 'notmuch-search-subject beg end))
 
-(defun notmuch-search-show-thread (&optional crypto-switch)
+(defun notmuch-search-show-thread ()
   "Display the currently selected thread."
-  (interactive "P")
+  (interactive)
   (let ((thread-id (notmuch-search-find-thread-id))
 	(subject (notmuch-prettify-subject (notmuch-search-find-subject))))
     (if (> (length thread-id) 0)
@@ -473,8 +473,7 @@ Complete list of currently available key bindings:
 		      (current-buffer)
 		      notmuch-search-query-string
 		      ;; Name the buffer based on the subject.
-		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*")
-		      crypto-switch)
+		      (concat "*" (truncate-string-to-width subject 30 nil nil t) "*"))
       (message "End of search results."))))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v3 1/2] emacs: Use text properties rather than overlays in `notmuch-show-mode'.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
  2012-02-08  8:02   ` [PATCH v8 1/8] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-12 15:47     ` David Bremner
  2012-02-08  8:02   ` [PATCH v8 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
                     ` (10 subsequent siblings)
  12 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

Except for where invisibility is involved, replace the use of overlays
in `notmuch-show-mode' with text properties, which are more efficient
and can be merged together more effectively.
---
 emacs/notmuch-show.el |   62 +++++++++++++++++++++++++++++++-----------------
 emacs/notmuch-wash.el |    8 ++++-
 2 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7469e2e..bc1e7db 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -264,10 +264,10 @@ operation on the contents of the current buffer."
 	       (t
 		'message-header-other))))
 
-    (overlay-put (make-overlay (point) (re-search-forward ":"))
-		 'face 'message-header-name)
-    (overlay-put (make-overlay (point) (re-search-forward ".*$"))
-		 'face face)))
+    (put-text-property (point) (re-search-forward ":")
+		       'face 'message-header-name)
+    (put-text-property (point) (re-search-forward ".*$")
+		       'face face)))
 
 (defun notmuch-show-colour-headers ()
   "Apply some colouring to the current headers."
@@ -284,12 +284,11 @@ operation on the contents of the current buffer."
   "Update the displayed tags of the current message."
   (save-excursion
     (goto-char (notmuch-show-message-top))
-    (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
-	(let ((inhibit-read-only t))
-	  (replace-match (concat "("
-				 (propertize (mapconcat 'identity tags " ")
-					     'face 'notmuch-tag-face)
-				 ")"))))))
+    (when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
+      (let ((inhibit-read-only t))
+	(replace-match (propertize (mapconcat 'identity tags " ")
+				   'face '(notmuch-tag-face notmuch-message-summary-face))
+		       nil nil nil 1)))))
 
 (defun notmuch-show-clean-address (address)
   "Try to clean a single email ADDRESS for display.  Return
@@ -352,15 +351,26 @@ unchanged ADDRESS if parsing fails."
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
   (let ((start (point)))
-    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
-	    (notmuch-show-clean-address (plist-get headers :From))
-	    " ("
-	    date
-	    ") ("
-	    (propertize (mapconcat 'identity tags " ")
-			'face 'notmuch-tag-face)
-	    ")\n")
-    (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))
+    (insert
+     (propertize (concat (notmuch-show-clean-address (plist-get headers :From))
+			 " ("
+			 date
+			 ") (")
+		 'face 'notmuch-message-summary-face)
+     (propertize (mapconcat 'identity tags " ")
+		 'face '(notmuch-tag-face notmuch-message-summary-face))
+     (propertize ")\n"
+		 'face 'notmuch-message-summary-face))
+
+    ;; Ensure that any insertions at the start of this line (usually
+    ;; just spaces for indentation purposes) inherit the face of the
+    ;; rest of the line...
+    (put-text-property start (1+ start)
+		       'front-sticky '(face))
+    ;; ...and that insertions at the end of this region do _not_
+    ;; inherit the face of the rest of this line.
+    (put-text-property (1- (point)) (point)
+		       'rear-nonsticky '(face))))
 
 (defun notmuch-show-insert-header (header header-value)
   "Insert a single header."
@@ -796,8 +806,15 @@ current buffer, if possible."
 (defun notmuch-show-insert-bodypart (msg part depth)
   "Insert the body part PART at depth DEPTH in the current thread."
   (let ((content-type (downcase (plist-get part :content-type)))
-	(nth (plist-get part :id)))
-    (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type))
+	(nth (plist-get part :id))
+	(start (point)))
+    (notmuch-show-insert-bodypart-internal msg part content-type nth depth content-type)
+
+    ;; Ensure that face properties applied to text in the buffer by
+    ;; the part handler don't leak into the following text.
+    (put-text-property start (point-max)
+		       'rear-nonsticky '(face)))
+
   ;; Some of the body part handlers leave point somewhere up in the
   ;; part, so we make sure that we're down at the end.
   (goto-char (point-max))
@@ -889,7 +906,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))
+    (indent-rigidly message-start message-end
+    		    (* notmuch-show-indent-messages-width depth))
 
     (setq message-end (point-max-marker))
 
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 56981d0..29a9d45 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -187,7 +187,9 @@ that PREFIX should not include a newline."
     (let* ((cite-start (match-beginning 0))
 	   (cite-end (match-end 0))
 	   (cite-lines (count-lines cite-start cite-end)))
-      (overlay-put (make-overlay cite-start cite-end) 'face 'message-cited-text)
+      (put-text-property cite-start cite-end 'face 'message-cited-text)
+      ;; Ensure that the next line doesn't inherit our face.
+      (put-text-property (1- cite-end) cite-end 'rear-nonsticky '(face))
       (when (> cite-lines (+ notmuch-wash-citation-lines-prefix
 			     notmuch-wash-citation-lines-suffix
 			     1))
@@ -209,7 +211,9 @@ that PREFIX should not include a newline."
 		  (sig-end-marker (make-marker)))
 	      (set-marker sig-start-marker sig-start)
 	      (set-marker sig-end-marker (point-max))
-	      (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 'message-cited-text)
+	      (put-text-property sig-start-marker sig-end-marker 'face 'message-cited-text)
+	      ;; Ensure that the next line doesn't inherit our face.
+	      (put-text-property (1- sig-end-marker) sig-end-marker 'rear-nonsticky '(face))
 	      (notmuch-wash-region-to-button
 	       msg sig-start-marker sig-end-marker
 	       "signature"))))))
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
  2012-02-08  8:02   ` [PATCH v8 1/8] emacs: Rework crypto switch toggle David Edmondson
  2012-02-08  8:02   ` [PATCH v3 1/2] emacs: Use text properties rather than overlays in `notmuch-show-mode' David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08  8:02   ` [PATCH v3 2/2] test: Update test to match previous patch David Edmondson
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

The current behaviour (all messages shown, non-matching collapsed)
is retained as the default. Type '!' to switch to showing only
the matching messages - non-matching messages are not available.
'!' will switch back to showing everything.
---
 emacs/notmuch-show.el |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 058913a..cd5de8f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -141,6 +141,10 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 (put 'notmuch-show-process-crypto 'permanent-local t)
 
+(defvar notmuch-show-elide-non-matching-messages nil)
+(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
+(put 'notmuch-show-elide-non-matching-messages '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
@@ -941,11 +945,22 @@ current buffer, if possible."
 	     "Not processing cryptographic MIME parts."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-elide-non-matching ()
+  "Toggle the display of non-matching messages."
+  (interactive)
+  (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages))
+  (message (if notmuch-show-elide-non-matching-messages
+	       "Showing matching messages only."
+	     "Showing all messages."))
+  (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))
 	(replies (cadr tree)))
-    (notmuch-show-insert-msg msg depth)
+    (if (or (not notmuch-show-elide-non-matching-messages)
+	    (plist-get msg :match))
+	(notmuch-show-insert-msg msg depth))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1099,6 +1114,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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-print-message)
+	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	map)
       "Keymap for \"notmuch show\" buffers.")
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v3 2/2] test: Update test to match previous patch.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (2 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-10-12 20:51     ` Ethan Glasser-Camp
  2012-02-08  8:02   ` [PATCH v8 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
                     ` (8 subsequent siblings)
  12 siblings, 1 reply; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

Indentation now uses tabs where possible.
---
 ...hread-maildir-storage-with-fourfold-indentation |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
index b0bf93e..1f7801e 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
@@ -69,7 +69,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
     notmuch mailing list
     notmuch@notmuchmail.org
     http://notmuchmail.org/mailman/listinfo/notmuch
-        Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed unread)
+	Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed unread)
 	Subject: Re: [notmuch] Working with Maildir storage?
 	To: Mikhail Gusarov <dottedmag@dottedmag.net>
 	Cc: notmuch@notmuchmail.org
@@ -101,7 +101,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
 	notmuch mailing list
 	notmuch@notmuchmail.org
 	http://notmuchmail.org/mailman/listinfo/notmuch
-            Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+	    Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
 	    Subject: [notmuch] Working with Maildir storage?
 	    To: notmuch@notmuchmail.org
 	    Date: Wed, 18 Nov 2009 02:50:48 +0600
@@ -129,7 +129,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
 	    Desc: not available
 	    URL:
 	    <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
-            Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+	    Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
 	    Subject: [notmuch] Working with Maildir storage?
 	    To: notmuch@notmuchmail.org
 	    Date: Tue, 17 Nov 2009 13:24:13 -0800
@@ -151,7 +151,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
 	    Thanks to everyone for trying out notmuch!
 
 	    -keith
-                Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+		Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
 		Subject: Re: [notmuch] Working with Maildir storage?
 		To: Keith Packard <keithp@keithp.com>
 		Cc: notmuch@notmuchmail.org
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 3/8] emacs: Allow the indentation of content to be toggled.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (3 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v3 2/2] test: Update test to match previous patch David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08  8:02   ` [PATCH v8 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

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 cd5de8f..8a792e9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -145,6 +145,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
@@ -255,10 +259,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)
@@ -899,7 +905,8 @@ current buffer, if possible."
     (setq body-start (point-marker))
     ;; A blank line between the headers and the body.
     (insert "\n")
-    (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"))
@@ -907,7 +914,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))
 
@@ -954,6 +962,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))
@@ -1116,6 +1133,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

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 4/8] emacs: Add a binding (t) to toggle the truncation of long lines.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (4 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08  8:02   ` [PATCH v8 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8a792e9..6c79511 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1134,6 +1134,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
 	(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)
+	(define-key map "t" 'toggle-truncate-lines)
 	map)
       "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (5 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08  8:02   ` [PATCH v8 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

With an argument, record and reply the state of the buffer during
`notmuch-show-refresh-view'.

In this context, "state" is defined as:
 - the open/closed state of each message,
 - the current message.

Traditional use of refresh with the = key does not retain the
state. The recently introduced toggle commands ($, !, < and >) do
retain the state.
---
 emacs/notmuch-show.el |   56 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6c79511..a668625 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -951,7 +951,7 @@ current buffer, if possible."
   (message (if notmuch-show-process-crypto
 	       "Processing cryptographic MIME parts."
 	     "Not processing cryptographic MIME parts."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-elide-non-matching ()
   "Toggle the display of non-matching messages."
@@ -960,7 +960,7 @@ current buffer, if possible."
   (message (if notmuch-show-elide-non-matching-messages
 	       "Showing matching messages only."
 	     "Showing all messages."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-toggle-thread-indentation ()
   "Toggle the indentation of threads."
@@ -969,7 +969,7 @@ current buffer, if possible."
   (message (if notmuch-show-indent-content
 	       "Content is indented."
 	     "Content is not indented."))
-  (notmuch-show-refresh-view))
+  (notmuch-show-refresh-view t))
 
 (defun notmuch-show-insert-tree (tree depth)
   "Insert the message tree TREE at depth DEPTH in the current thread."
@@ -1073,14 +1073,54 @@ function is used."
 
     (notmuch-show-mark-read)))
 
-(defun notmuch-show-refresh-view ()
+(defun notmuch-show-capture-state ()
+  "Capture the state of the current buffer.
+
+This includes:
+ - the list of open messages,
+ - the current message."
+  (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
+
+(defun notmuch-show-apply-state (state)
+  "Apply STATE to the current buffer.
+
+This includes:
+ - opening the messages previously opened,
+ - closing all other messages,
+ - moving to the correct current message."
+  (let ((current (car state))
+	(open (cadr state)))
+
+    ;; Open those that were open.
+    (goto-char (point-min))
+    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
+					   (member (notmuch-show-get-message-id) open))
+	  until (not (notmuch-show-goto-message-next)))
+
+    ;; Go to the previously open message.
+    (goto-char (point-min))
+    (unless (loop if (string= current (notmuch-show-get-message-id))
+		  return t
+		  until (not (notmuch-show-goto-message-next)))
+      (goto-char (point-min))
+      (message "Previously current message not found."))
+    (notmuch-show-message-adjust)))
+
+(defun notmuch-show-refresh-view (&optional retain-state)
   "Refresh the current view.
 
-Refreshes the current view, observing changes in cryptographic preferences."
+Refreshes the current view, observing changes in display
+preferences. If RETAIN-STATE is non-nil then the state of the
+buffer is stored and re-applied after the refresh."
   (interactive)
-  (let ((inhibit-read-only t))
-    (erase-buffer))
-  (notmuch-show-worker))
+  (let ((inhibit-read-only t)
+	state)
+    (if retain-state
+	(setq state (notmuch-show-capture-state)))
+    (erase-buffer)
+    (notmuch-show-worker)
+    (if state
+	(notmuch-show-apply-state state))))
 
 (defvar notmuch-show-stash-map
   (let ((map (make-sparse-keymap)))
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 6/8] emacs: Check that the parent buffer is alive before using it.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (6 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08  8:02   ` [PATCH v8 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

---
 emacs/notmuch-show.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a668625..bb46523 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1686,7 +1686,7 @@ added."
   (interactive "P")
   (let ((parent-buffer notmuch-show-parent-buffer))
     (notmuch-kill-this-buffer)
-    (when parent-buffer
+    (when (buffer-live-p parent-buffer)
       (switch-to-buffer parent-buffer)
       (notmuch-search-next-thread)
       (if show-next
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 7/8] emacs: Add `notmuch-show-only-matching-messages'.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (7 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08  8:02   ` [PATCH v8 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

Allow the user to choose that only matching messages are shown by
default.
---
 emacs/notmuch-show.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index bb46523..d077ae0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,11 @@ indentation."
 		 (const :tag "View interactively"
 			notmuch-show-interactively-view-part)))
 
+(defcustom notmuch-show-only-matching-messages nil
+  "Only matching messages are shown by default."
+  :type 'boolean
+  :group 'notmuch-show)
+
 (defvar notmuch-show-thread-id nil)
 (make-variable-buffer-local 'notmuch-show-thread-id)
 (put 'notmuch-show-thread-id 'permanent-local t)
@@ -1031,6 +1036,9 @@ function is used."
     ;; Set the default value for `notmuch-show-process-crypto' in this
     ;; buffer.
     (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
+    ;; Set the default value for
+    ;; `notmuch-show-elide-non-matching-messages' in this buffer.
+    (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH v8 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour.
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (8 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
@ 2012-02-08  8:02   ` David Edmondson
  2012-02-08 19:15   ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08  8:02 UTC (permalink / raw)
  To: notmuch

Allow the user to open a thread with inverted
`notmuch-show-only-matching-messages' behaviour using a prefix
argument.
---
 emacs/notmuch-show.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index d077ae0..fc36524 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1037,8 +1037,11 @@ function is used."
     ;; buffer.
     (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
     ;; Set the default value for
-    ;; `notmuch-show-elide-non-matching-messages' in this buffer.
+    ;; `notmuch-show-elide-non-matching-messages' in this buffer. If
+    ;; there is a prefix argument, invert the default.
     (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)
+    (if current-prefix-arg
+	(setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages)))
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v8 1/8] emacs: Rework crypto switch toggle.
  2012-02-08  8:02   ` [PATCH v8 1/8] emacs: Rework crypto switch toggle David Edmondson
@ 2012-02-08 14:38     ` Austin Clements
  0 siblings, 0 replies; 87+ messages in thread
From: Austin Clements @ 2012-02-08 14:38 UTC (permalink / raw)
  To: David Edmondson; +Cc: notmuch

Quoth David Edmondson on Feb 08 at  8:02 am:
> Re-work the existing crypto switch toggle to be based on a persistant
> buffer-local variable.
> 
> To allow this, modify `notmuch-show-refresh-view' to erase and re-draw
> in the current buffer rather than killing the current buffer and
> creating a new one. (This will also allow more per-buffer behaviour in
> future patches.)
> 
> Add a binding ('$') to toggle crypto processing of the current buffer
> and remove the prefix argument approach that achieves a similar
> result.

LGTM.

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (9 preceding siblings ...)
  2012-02-08  8:02   ` [PATCH v8 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
@ 2012-02-08 19:15   ` David Edmondson
  2012-02-12 17:36   ` David Bremner
  2012-02-19 20:56   ` Pieter Praet
  12 siblings, 0 replies; 87+ messages in thread
From: David Edmondson @ 2012-02-08 19:15 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 79 bytes --]

v8 rebased onto master after Dmitry's changes without any manual
intervention.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v3 1/2] emacs: Use text properties rather than overlays in `notmuch-show-mode'.
  2012-02-08  8:02   ` [PATCH v3 1/2] emacs: Use text properties rather than overlays in `notmuch-show-mode' David Edmondson
@ 2012-02-12 15:47     ` David Bremner
  0 siblings, 0 replies; 87+ messages in thread
From: David Bremner @ 2012-02-12 15:47 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Wed,  8 Feb 2012 08:02:11 +0000, David Edmondson <dme@dme.org> wrote:
> Except for where invisibility is involved, replace the use of overlays
> in `notmuch-show-mode' with text properties, which are more efficient
> and can be merged together more effectively.

Hi David;

Not quite sure why there is a second copy of v3 mixed in with another
patch series. I guess just some cut and paste problems with
git-send-email. It sounds like it needs a rebase in any case.

d

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (10 preceding siblings ...)
  2012-02-08 19:15   ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-02-12 17:36   ` David Bremner
  2012-02-19 20:56   ` Pieter Praet
  12 siblings, 0 replies; 87+ messages in thread
From: David Bremner @ 2012-02-12 17:36 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Wed,  8 Feb 2012 08:02:09 +0000, David Edmondson <dme@dme.org> wrote:
> v8:
> - Code review comments from Austin:
>   - Correctly decrypt parts when saving, etc. them. (revert to
>     original behaviour).

pushed,

d

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles
  2012-02-08  8:02 ` [PATCH v8 " David Edmondson
                     ` (11 preceding siblings ...)
  2012-02-12 17:36   ` David Bremner
@ 2012-02-19 20:56   ` Pieter Praet
  2012-02-19 20:56     ` [PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show' Pieter Praet
                       ` (3 more replies)
  12 siblings, 4 replies; 87+ messages in thread
From: Pieter Praet @ 2012-02-19 20:56 UTC (permalink / raw)
  To: David Edmondson; +Cc: Notmuch Mail

Great work!

Here's some tests.


Peace

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show'
  2012-02-19 20:56   ` Pieter Praet
@ 2012-02-19 20:56     ` Pieter Praet
  2012-10-17 23:59       ` [PATCH 1/3] test: emacs: toggle eliding of non-matching messages " Ethan Glasser-Camp
  2012-02-19 20:56     ` [PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show' Pieter Praet
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 87+ messages in thread
From: Pieter Praet @ 2012-02-19 20:56 UTC (permalink / raw)
  To: David Edmondson; +Cc: Notmuch Mail

See commit 19ec74c5.
---
 test/emacs                                         |   20 ++++++++++++
 .../notmuch-show-process-crypto-mime-parts-off     |   31 +++++++++++++++++++
 .../notmuch-show-process-crypto-mime-parts-on      |   32 ++++++++++++++++++++
 3 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
 create mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on

diff --git a/test/emacs b/test/emacs
index b74cfa9..b207d20 100755
--- a/test/emacs
+++ b/test/emacs
@@ -534,4 +534,24 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 2
 
+test_begin_subtest "notmuch-show: don't process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-off
+
+test_begin_subtest "notmuch-show: process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime t))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+test_begin_subtest "notmuch-show: process cryptographic MIME parts (w/ notmuch-show-toggle-process-crypto)"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(notmuch-show-toggle-process-crypto)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+
 test_done
diff --git a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
new file mode 100644
index 0000000..076083a
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
@@ -0,0 +1,31 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
new file mode 100644
index 0000000..588f38f
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
@@ -0,0 +1,32 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
-- 
1.7.8.1

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show'
  2012-02-19 20:56   ` Pieter Praet
  2012-02-19 20:56     ` [PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show' Pieter Praet
@ 2012-02-19 20:56     ` Pieter Praet
  2012-04-17 17:45       ` Mark Walters
  2012-02-19 20:56     ` [PATCH 3/3] test: emacs: toggle thread content indentation " Pieter Praet
  2012-10-15 22:17     ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles Ethan Glasser-Camp
  3 siblings, 1 reply; 87+ messages in thread
From: Pieter Praet @ 2012-02-19 20:56 UTC (permalink / raw)
  To: David Edmondson; +Cc: Notmuch Mail

See commits 44a544ed, 866ce8b1, 668b66ec.
---
 test/emacs                                         |   38 ++++++++++
 .../notmuch-show-elide-non-matching-messages-off   |   79 ++++++++++++++++++++
 .../notmuch-show-elide-non-matching-messages-on    |   75 +++++++++++++++++++
 3 files changed, 192 insertions(+), 0 deletions(-)
 create mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
 create mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on

diff --git a/test/emacs b/test/emacs
index b207d20..320057a 100755
--- a/test/emacs
+++ b/test/emacs
@@ -553,5 +553,43 @@ test_emacs '(let ((notmuch-crypto-process-mime nil))
 	(test-visible-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
 
+test_begin_subtest "notmuch-show: don't elide non-matching messages"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-off
+
+test_begin_subtest "notmuch-show: elide non-matching messages"
+test_emacs '(let ((notmuch-show-only-matching-messages t))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(notmuch-show-toggle-elide-non-matching)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to notmuch-show)"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(let ((current-prefix-arg t))
+	  (notmuch-search-show-thread))
+	(notmuch-test-wait)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
+
 
 test_done
diff --git a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
new file mode 100644
index 0000000..b31fe62
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
@@ -0,0 +1,79 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+    Subject: Re: [notmuch] Working with Maildir storage?
+    To: Keith Packard <keithp@keithp.com>
+    Cc: notmuch@notmuchmail.org
+    Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+    [ multipart/mixed ]
+    [ multipart/signed ]
+    [ text/plain ]
+    > I've also pushed a slightly more complicated (and complete) fix to my
+    > private notmuch repository
+
+    The version of lib/messages.cc in your repo doesn't build because it's
+    missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+    [ 4-line signature. Click/Enter to show. ]
+    [ application/pgp-signature ]
+    [ text/plain ]
+    [ 4-line signature. Click/Enter to show. ]
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
new file mode 100644
index 0000000..bafb479
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
@@ -0,0 +1,75 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+    Subject: Re: [notmuch] Working with Maildir storage?
+    To: Keith Packard <keithp@keithp.com>
+    Cc: notmuch@notmuchmail.org
+    Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+    [ multipart/mixed ]
+    [ multipart/signed ]
+    [ text/plain ]
+    > I've also pushed a slightly more complicated (and complete) fix to my
+    > private notmuch repository
+
+    The version of lib/messages.cc in your repo doesn't build because it's
+    missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+    [ 4-line signature. Click/Enter to show. ]
+    [ application/pgp-signature ]
+    [ text/plain ]
+    [ 4-line signature. Click/Enter to show. ]
-- 
1.7.8.1

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* [PATCH 3/3] test: emacs: toggle thread content indentation in `notmuch-show'
  2012-02-19 20:56   ` Pieter Praet
  2012-02-19 20:56     ` [PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show' Pieter Praet
  2012-02-19 20:56     ` [PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show' Pieter Praet
@ 2012-02-19 20:56     ` Pieter Praet
  2012-10-15 22:17     ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles Ethan Glasser-Camp
  3 siblings, 0 replies; 87+ messages in thread
From: Pieter Praet @ 2012-02-19 20:56 UTC (permalink / raw)
  To: David Edmondson; +Cc: Notmuch Mail

See commit c205e8ff.
---
 test/emacs                                         |    9 ++
 .../notmuch-show-indent-thread-content-off         |   79 ++++++++++++++++++++
 2 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 test/emacs.expected-output/notmuch-show-indent-thread-content-off

diff --git a/test/emacs b/test/emacs
index 320057a..357ac73 100755
--- a/test/emacs
+++ b/test/emacs
@@ -591,5 +591,14 @@ test_emacs '(let ((notmuch-show-only-matching-messages nil))
 	(test-visible-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
 
+test_begin_subtest "notmuch-show: disable indentation of thread content (w/ notmuch-show-toggle-thread-indentation)"
+test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(notmuch-show-toggle-thread-indentation)
+	(test-visible-output)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
+
 
 test_done
diff --git a/test/emacs.expected-output/notmuch-show-indent-thread-content-off b/test/emacs.expected-output/notmuch-show-indent-thread-content-off
new file mode 100644
index 0000000..37b4f7d
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-indent-thread-content-off
@@ -0,0 +1,79 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: Re: [notmuch] Working with Maildir storage?
+To: Mikhail Gusarov <dottedmag@dottedmag.net>
+Cc: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+> See the patch just posted here.
+
+Is the list archived anywhere?  The obvious archives
+(http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+think I subscribed too late to get the patch (I only just saw the
+discussion about it).
+
+It doesn't look like the patch is in git yet.
+
+-- Lars
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+Subject: Re: [notmuch] Working with Maildir storage?
+To: Keith Packard <keithp@keithp.com>
+Cc: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+> I've also pushed a slightly more complicated (and complete) fix to my
+> private notmuch repository
+
+The version of lib/messages.cc in your repo doesn't build because it's
+missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
-- 
1.7.8.1

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show'
  2012-02-19 20:56     ` [PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show' Pieter Praet
@ 2012-04-17 17:45       ` Mark Walters
  0 siblings, 0 replies; 87+ messages in thread
From: Mark Walters @ 2012-04-17 17:45 UTC (permalink / raw)
  To: Pieter Praet, David Edmondson; +Cc: Notmuch Mail

On Sun, 19 Feb 2012, Pieter Praet <pieter@praet.org> wrote:
> See commits 44a544ed, 866ce8b1, 668b66ec.
> ---
>  test/emacs                                         |   38 ++++++++++
>  .../notmuch-show-elide-non-matching-messages-off   |   79 ++++++++++++++++++++
>  .../notmuch-show-elide-non-matching-messages-on    |   75 +++++++++++++++++++
>  3 files changed, 192 insertions(+), 0 deletions(-)
>  create mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
>  create mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on

This patch looks good to me and with other possible ways of implementing
elide [1] seems well worth having.

It needs [1/3] which I think is ok but I have never used the crypto
stuff so wouldn't count this as a review of that patch.

Patch [3/3] also looks fine.

Best wishes

Mark

[1] id:"1334077496-9172-1-git-send-email-markwalters1009@gmail.com"
>
> diff --git a/test/emacs b/test/emacs
> index b207d20..320057a 100755
> --- a/test/emacs
> +++ b/test/emacs
> @@ -553,5 +553,43 @@ test_emacs '(let ((notmuch-crypto-process-mime nil))
>  	(test-visible-output))'
>  test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
>  
> +test_begin_subtest "notmuch-show: don't elide non-matching messages"
> +test_emacs '(let ((notmuch-show-only-matching-messages nil))
> +	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
> +	(notmuch-test-wait)
> +	(notmuch-search-show-thread)
> +	(notmuch-test-wait)
> +	(test-visible-output))'
> +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-off
> +
> +test_begin_subtest "notmuch-show: elide non-matching messages"
> +test_emacs '(let ((notmuch-show-only-matching-messages t))
> +	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
> +	(notmuch-test-wait)
> +	(notmuch-search-show-thread)
> +	(notmuch-test-wait)
> +	(test-visible-output))'
> +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
> +
> +test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)"
> +test_emacs '(let ((notmuch-show-only-matching-messages nil))
> +	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
> +	(notmuch-test-wait)
> +	(notmuch-search-show-thread)
> +	(notmuch-test-wait)
> +	(notmuch-show-toggle-elide-non-matching)
> +	(test-visible-output))'
> +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
> +
> +test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to notmuch-show)"
> +test_emacs '(let ((notmuch-show-only-matching-messages nil))
> +	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
> +	(notmuch-test-wait)
> +	(let ((current-prefix-arg t))
> +	  (notmuch-search-show-thread))
> +	(notmuch-test-wait)
> +	(test-visible-output))'
> +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
> +
>  
>  test_done
> diff --git a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
> new file mode 100644
> index 0000000..b31fe62
> --- /dev/null
> +++ b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
> @@ -0,0 +1,79 @@
> +Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
> +Subject: [notmuch] Working with Maildir storage?
> +To: notmuch@notmuchmail.org
> +Date: Tue, 17 Nov 2009 14:00:54 -0500
> +
> +[ multipart/mixed ]
> +[ multipart/signed ]
> +[ text/plain ]
> +I saw the LWN article and decided to take a look at notmuch.  I'm
> +currently using mutt and mairix to index and read a collection of
> +Maildir mail folders (around 40,000 messages total).
> +
> +notmuch indexed the messages without complaint, but my attempt at
> +searching bombed out. Running, for example:
> +
> +  notmuch search storage
> +
> +Resulted in 4604 lines of errors along the lines of:
> +
> +  Error opening
> +  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
> +  Too many open files
> +
> +I'm curious if this is expected behavior (i.e., notmuch does not work
> +with Maildir) or if something else is going on.
> +
> +Cheers,
> +
> +[ 4-line signature. Click/Enter to show. ]
> +[ application/pgp-signature ]
> +[ text/plain ]
> +[ 4-line signature. Click/Enter to show. ]
> + Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
> +  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
> +  Subject: Re: [notmuch] Working with Maildir storage?
> +  To: Mikhail Gusarov <dottedmag@dottedmag.net>
> +  Cc: notmuch@notmuchmail.org
> +  Date: Tue, 17 Nov 2009 15:33:01 -0500
> +
> +  [ multipart/mixed ]
> +  [ multipart/signed ]
> +  [ text/plain ]
> +  > See the patch just posted here.
> +
> +  Is the list archived anywhere?  The obvious archives
> +  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
> +  think I subscribed too late to get the patch (I only just saw the
> +  discussion about it).
> +
> +  It doesn't look like the patch is in git yet.
> +
> +  -- Lars
> +
> +  [ 4-line signature. Click/Enter to show. ]
> +  [ application/pgp-signature ]
> +  [ text/plain ]
> +  [ 4-line signature. Click/Enter to show. ]
> +   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
> +   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
> +    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
> +    Subject: Re: [notmuch] Working with Maildir storage?
> +    To: Keith Packard <keithp@keithp.com>
> +    Cc: notmuch@notmuchmail.org
> +    Date: Tue, 17 Nov 2009 19:50:40 -0500
> +
> +    [ multipart/mixed ]
> +    [ multipart/signed ]
> +    [ text/plain ]
> +    > I've also pushed a slightly more complicated (and complete) fix to my
> +    > private notmuch repository
> +
> +    The version of lib/messages.cc in your repo doesn't build because it's
> +    missing "#include <stdint.h>" (for the uint32_t on line 466).
> +
> +    [ 4-line signature. Click/Enter to show. ]
> +    [ application/pgp-signature ]
> +    [ text/plain ]
> +    [ 4-line signature. Click/Enter to show. ]
> + Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
> diff --git a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
> new file mode 100644
> index 0000000..bafb479
> --- /dev/null
> +++ b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
> @@ -0,0 +1,75 @@
> +Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
> +Subject: [notmuch] Working with Maildir storage?
> +To: notmuch@notmuchmail.org
> +Date: Tue, 17 Nov 2009 14:00:54 -0500
> +
> +[ multipart/mixed ]
> +[ multipart/signed ]
> +[ text/plain ]
> +I saw the LWN article and decided to take a look at notmuch.  I'm
> +currently using mutt and mairix to index and read a collection of
> +Maildir mail folders (around 40,000 messages total).
> +
> +notmuch indexed the messages without complaint, but my attempt at
> +searching bombed out. Running, for example:
> +
> +  notmuch search storage
> +
> +Resulted in 4604 lines of errors along the lines of:
> +
> +  Error opening
> +  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
> +  Too many open files
> +
> +I'm curious if this is expected behavior (i.e., notmuch does not work
> +with Maildir) or if something else is going on.
> +
> +Cheers,
> +
> +[ 4-line signature. Click/Enter to show. ]
> +[ application/pgp-signature ]
> +[ text/plain ]
> +[ 4-line signature. Click/Enter to show. ]
> +  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
> +  Subject: Re: [notmuch] Working with Maildir storage?
> +  To: Mikhail Gusarov <dottedmag@dottedmag.net>
> +  Cc: notmuch@notmuchmail.org
> +  Date: Tue, 17 Nov 2009 15:33:01 -0500
> +
> +  [ multipart/mixed ]
> +  [ multipart/signed ]
> +  [ text/plain ]
> +  > See the patch just posted here.
> +
> +  Is the list archived anywhere?  The obvious archives
> +  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
> +  think I subscribed too late to get the patch (I only just saw the
> +  discussion about it).
> +
> +  It doesn't look like the patch is in git yet.
> +
> +  -- Lars
> +
> +  [ 4-line signature. Click/Enter to show. ]
> +  [ application/pgp-signature ]
> +  [ text/plain ]
> +  [ 4-line signature. Click/Enter to show. ]
> +    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
> +    Subject: Re: [notmuch] Working with Maildir storage?
> +    To: Keith Packard <keithp@keithp.com>
> +    Cc: notmuch@notmuchmail.org
> +    Date: Tue, 17 Nov 2009 19:50:40 -0500
> +
> +    [ multipart/mixed ]
> +    [ multipart/signed ]
> +    [ text/plain ]
> +    > I've also pushed a slightly more complicated (and complete) fix to my
> +    > private notmuch repository
> +
> +    The version of lib/messages.cc in your repo doesn't build because it's
> +    missing "#include <stdint.h>" (for the uint32_t on line 466).
> +
> +    [ 4-line signature. Click/Enter to show. ]
> +    [ application/pgp-signature ]
> +    [ text/plain ]
> +    [ 4-line signature. Click/Enter to show. ]
> -- 
> 1.7.8.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v3 2/2] test: Update test to match previous patch.
  2012-02-08  8:02   ` [PATCH v3 2/2] test: Update test to match previous patch David Edmondson
@ 2012-10-12 20:51     ` Ethan Glasser-Camp
  2012-10-14 23:17       ` Jameson Graef Rollins
  0 siblings, 1 reply; 87+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-12 20:51 UTC (permalink / raw)
  To: David Edmondson, notmuch

David Edmondson <dme@dme.org> writes:

> Indentation now uses tabs where possible.

Hi! Just working through the patch queue. This patch is tagged
notmuch::moreinfo, although it seems like the rest of the series may
have been tagged notmuch::stale or notmuch::pushed. It's a little hard
to figure out, because the thread structure is really messed up. Is this
patch still viable? It now *breaks* the emacs test on my machine.

Ethan

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v3 2/2] test: Update test to match previous patch.
  2012-10-12 20:51     ` Ethan Glasser-Camp
@ 2012-10-14 23:17       ` Jameson Graef Rollins
  0 siblings, 0 replies; 87+ messages in thread
From: Jameson Graef Rollins @ 2012-10-14 23:17 UTC (permalink / raw)
  To: Ethan Glasser-Camp, David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On Fri, Oct 12 2012, Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> wrote:
> David Edmondson <dme@dme.org> writes:
>
>> Indentation now uses tabs where possible.
>
> Hi! Just working through the patch queue. This patch is tagged
> notmuch::moreinfo, although it seems like the rest of the series may
> have been tagged notmuch::stale or notmuch::pushed. It's a little hard
> to figure out, because the thread structure is really messed up. Is this
> patch still viable? It now *breaks* the emacs test on my machine.

Hey, Ethan.  I would say that anything this old should just
automatically be tagged stale.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles
  2012-02-19 20:56   ` Pieter Praet
                       ` (2 preceding siblings ...)
  2012-02-19 20:56     ` [PATCH 3/3] test: emacs: toggle thread content indentation " Pieter Praet
@ 2012-10-15 22:17     ` Ethan Glasser-Camp
  2012-10-18  0:41       ` David Bremner
  3 siblings, 1 reply; 87+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-15 22:17 UTC (permalink / raw)
  To: Pieter Praet, David Edmondson; +Cc: Notmuch Mail

Pieter Praet <pieter@praet.org> writes:

> Great work!
>
> Here's some tests.

Hi! These look fine to me. With Mark's review
(id:"87k41e45hi.fsf@qmul.ac.uk"), I'm removing the needs-review tag.

Ethan

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH 1/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show'
  2012-02-19 20:56     ` [PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show' Pieter Praet
@ 2012-10-17 23:59       ` Ethan Glasser-Camp
  2012-10-18  2:16         ` [PATCH] test: Move tests from emacs to emacs-show Ethan Glasser-Camp
  0 siblings, 1 reply; 87+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-17 23:59 UTC (permalink / raw)
  To: notmuch; +Cc: Ethan Glasser-Camp, Pieter Praet

From: Pieter Praet <pieter@praet.org>

See commits 44a544ed, 866ce8b1, 668b66ec.

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
---
I am embarrassed to admit I didn't try to apply these patches before I
removed the needs-review tag. This one didn't apply. Here's the
trivial fix. The tests are still placed at the bottom of test/emacs
and not in test/emacs-show. The other two patches should apply without
change.

 test/emacs                                         |   20 ++++++++++++
 .../notmuch-show-process-crypto-mime-parts-off     |   31 +++++++++++++++++++
 .../notmuch-show-process-crypto-mime-parts-on      |   32 ++++++++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
 create mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on

diff --git a/test/emacs b/test/emacs
index 1f84b91..58ea59a 100755
--- a/test/emacs
+++ b/test/emacs
@@ -783,4 +783,24 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 
+test_begin_subtest "don't process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-off
+
+test_begin_subtest "process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime t))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+test_begin_subtest "process cryptographic MIME parts (w/ notmuch-show-toggle-process-crypto)"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(notmuch-show-toggle-process-crypto)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+
 test_done
diff --git a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
new file mode 100644
index 0000000..076083a
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
@@ -0,0 +1,31 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
new file mode 100644
index 0000000..588f38f
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
@@ -0,0 +1,32 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles
  2012-10-15 22:17     ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles Ethan Glasser-Camp
@ 2012-10-18  0:41       ` David Bremner
  0 siblings, 0 replies; 87+ messages in thread
From: David Bremner @ 2012-10-18  0:41 UTC (permalink / raw)
  To: Ethan Glasser-Camp, Pieter Praet; +Cc: Notmuch Mail

Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> writes:

> Pieter Praet <pieter@praet.org> writes:
>
>> Great work!
>>
>> Here's some tests.
>
> Hi! These look fine to me. With Mark's review
> (id:"87k41e45hi.fsf@qmul.ac.uk"), I'm removing the needs-review tag.

Tests pushed (with Ethan's rebased version of the first patch)

d

^ permalink raw reply	[flat|nested] 87+ messages in thread

* [PATCH] test: Move tests from emacs to emacs-show
  2012-10-17 23:59       ` [PATCH 1/3] test: emacs: toggle eliding of non-matching messages " Ethan Glasser-Camp
@ 2012-10-18  2:16         ` Ethan Glasser-Camp
  2012-10-18 10:19           ` Tomi Ollila
  2012-10-18 12:02           ` David Bremner
  0 siblings, 2 replies; 87+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-18  2:16 UTC (permalink / raw)
  To: notmuch; +Cc: Ethan Glasser-Camp

This requires changing the contents of the crypto tests, as one thread
that was marked read by the earlier tests in test/emacs is no longer
marked read.

This moves tests for:

- 09d19ac "test: emacs: toggle eliding of non-matching messages in
   `notmuch-show'", which should have actually read: "test: emacs:
   toggle processing of cryptographic MIME parts in `notmuch-show'".
   See commit 19ec74c5.

- 5ea1dbe "test: emacs: toggle eliding of non-matching messages in
  `notmuch-show'"

- 345faab "test: emacs: toggle thread content indentation in
  `notmuch-show'"

Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
---
I screwed up with git commit --amend or something on the last patch,
so David Bremner suggested that I take advantage of the situation to
write this patch, which does something useful as a side effect.

 test/emacs                                         |   67 -----------------
 test/emacs-show                                    |   71 ++++++++++++++++++
 .../notmuch-show-elide-non-matching-messages-off   |   79 ++++++++++++++++++++
 .../notmuch-show-elide-non-matching-messages-on    |   75 +++++++++++++++++++
 .../notmuch-show-indent-thread-content-off         |   79 ++++++++++++++++++++
 .../notmuch-show-process-crypto-mime-parts-off     |   31 ++++++++
 .../notmuch-show-process-crypto-mime-parts-on      |   32 ++++++++
 .../notmuch-show-elide-non-matching-messages-off   |   79 --------------------
 .../notmuch-show-elide-non-matching-messages-on    |   75 -------------------
 .../notmuch-show-indent-thread-content-off         |   79 --------------------
 .../notmuch-show-process-crypto-mime-parts-off     |   31 --------
 .../notmuch-show-process-crypto-mime-parts-on      |   32 --------
 12 files changed, 367 insertions(+), 363 deletions(-)
 create mode 100644 test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off
 create mode 100644 test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on
 create mode 100644 test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
 create mode 100644 test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
 create mode 100644 test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on
 delete mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
 delete mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
 delete mode 100644 test/emacs.expected-output/notmuch-show-indent-thread-content-off
 delete mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
 delete mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on

diff --git a/test/emacs b/test/emacs
index e9d8239..1f84b91 100755
--- a/test/emacs
+++ b/test/emacs
@@ -783,71 +783,4 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 
-test_begin_subtest "don't process cryptographic MIME parts"
-test_emacs '(let ((notmuch-crypto-process-mime nil))
-	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-off
-
-test_begin_subtest "process cryptographic MIME parts"
-test_emacs '(let ((notmuch-crypto-process-mime t))
-	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
-
-test_begin_subtest "process cryptographic MIME parts (w/ notmuch-show-toggle-process-crypto)"
-test_emacs '(let ((notmuch-crypto-process-mime nil))
-	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
-	(notmuch-show-toggle-process-crypto)
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
-
-test_begin_subtest "notmuch-show: don't elide non-matching messages"
-test_emacs '(let ((notmuch-show-only-matching-messages nil))
-	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
-	(notmuch-test-wait)
-	(notmuch-search-show-thread)
-	(notmuch-test-wait)
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-off
-
-test_begin_subtest "notmuch-show: elide non-matching messages"
-test_emacs '(let ((notmuch-show-only-matching-messages t))
-	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
-	(notmuch-test-wait)
-	(notmuch-search-show-thread)
-	(notmuch-test-wait)
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
-
-test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)"
-test_emacs '(let ((notmuch-show-only-matching-messages nil))
-	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
-	(notmuch-test-wait)
-	(notmuch-search-show-thread)
-	(notmuch-test-wait)
-	(notmuch-show-toggle-elide-non-matching)
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
-
-test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to notmuch-show)"
-test_emacs '(let ((notmuch-show-only-matching-messages nil))
-	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
-	(notmuch-test-wait)
-	(let ((current-prefix-arg t))
-	  (notmuch-search-show-thread))
-	(notmuch-test-wait)
-	(test-visible-output))'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
-
-test_begin_subtest "notmuch-show: disable indentation of thread content (w/ notmuch-show-toggle-thread-indentation)"
-test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
-	(notmuch-test-wait)
-	(notmuch-search-show-thread)
-	(notmuch-test-wait)
-	(notmuch-show-toggle-thread-indentation)
-	(test-visible-output)'
-test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
-
-
 test_done
diff --git a/test/emacs-show b/test/emacs-show
index e9a714f..64c38d3 100755
--- a/test/emacs-show
+++ b/test/emacs-show
@@ -3,6 +3,10 @@
 test_description="emacs notmuch-show view"
 . test-lib.sh
 
+EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
+
+add_email_corpus
+
 test_begin_subtest "Hiding Original Message region at beginning of a message"
 message_id='OriginalMessageHiding.1@notmuchmail.org'
 add_message \
@@ -36,4 +40,71 @@ test_begin_subtest "Bare subject #3"
 output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
 test_expect_equal "$output" '"the cure: fix the regexp"'
 
+test_begin_subtest "don't process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-off
+
+test_begin_subtest "process cryptographic MIME parts"
+test_emacs '(let ((notmuch-crypto-process-mime t))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+test_begin_subtest "process cryptographic MIME parts (w/ notmuch-show-toggle-process-crypto)"
+test_emacs '(let ((notmuch-crypto-process-mime nil))
+	(notmuch-show "id:20091117203301.GV3165@dottiness.seas.harvard.edu")
+	(notmuch-show-toggle-process-crypto)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-process-crypto-mime-parts-on
+
+test_begin_subtest "notmuch-show: don't elide non-matching messages"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-off
+
+test_begin_subtest "notmuch-show: elide non-matching messages"
+test_emacs '(let ((notmuch-show-only-matching-messages t))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(notmuch-show-toggle-elide-non-matching)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to notmuch-show)"
+test_emacs '(let ((notmuch-show-only-matching-messages nil))
+	(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(let ((current-prefix-arg t))
+	  (notmuch-search-show-thread))
+	(notmuch-test-wait)
+	(test-visible-output))'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on
+
+test_begin_subtest "notmuch-show: disable indentation of thread content (w/ notmuch-show-toggle-thread-indentation)"
+test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")
+	(notmuch-test-wait)
+	(notmuch-search-show-thread)
+	(notmuch-test-wait)
+	(notmuch-show-toggle-thread-indentation)
+	(test-visible-output)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
+
+
 test_done
diff --git a/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off
new file mode 100644
index 0000000..b31fe62
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off
@@ -0,0 +1,79 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+    Subject: Re: [notmuch] Working with Maildir storage?
+    To: Keith Packard <keithp@keithp.com>
+    Cc: notmuch@notmuchmail.org
+    Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+    [ multipart/mixed ]
+    [ multipart/signed ]
+    [ text/plain ]
+    > I've also pushed a slightly more complicated (and complete) fix to my
+    > private notmuch repository
+
+    The version of lib/messages.cc in your repo doesn't build because it's
+    missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+    [ 4-line signature. Click/Enter to show. ]
+    [ application/pgp-signature ]
+    [ text/plain ]
+    [ 4-line signature. Click/Enter to show. ]
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on
new file mode 100644
index 0000000..bafb479
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on
@@ -0,0 +1,75 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+    Subject: Re: [notmuch] Working with Maildir storage?
+    To: Keith Packard <keithp@keithp.com>
+    Cc: notmuch@notmuchmail.org
+    Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+    [ multipart/mixed ]
+    [ multipart/signed ]
+    [ text/plain ]
+    > I've also pushed a slightly more complicated (and complete) fix to my
+    > private notmuch repository
+
+    The version of lib/messages.cc in your repo doesn't build because it's
+    missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+    [ 4-line signature. Click/Enter to show. ]
+    [ application/pgp-signature ]
+    [ text/plain ]
+    [ 4-line signature. Click/Enter to show. ]
diff --git a/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off b/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
new file mode 100644
index 0000000..37b4f7d
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
@@ -0,0 +1,79 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: Re: [notmuch] Working with Maildir storage?
+To: Mikhail Gusarov <dottedmag@dottedmag.net>
+Cc: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+> See the patch just posted here.
+
+Is the list archived anywhere?  The obvious archives
+(http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+think I subscribed too late to get the patch (I only just saw the
+discussion about it).
+
+It doesn't look like the patch is in git yet.
+
+-- Lars
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+Subject: Re: [notmuch] Working with Maildir storage?
+To: Keith Packard <keithp@keithp.com>
+Cc: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+> I've also pushed a slightly more complicated (and complete) fix to my
+> private notmuch repository
+
+The version of lib/messages.cc in your repo doesn't build because it's
+missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+[ 4-line signature. Click/Enter to show. ]
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
new file mode 100644
index 0000000..3282c7b
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
@@ -0,0 +1,31 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed unread)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on
new file mode 100644
index 0000000..eaa557a
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on
@@ -0,0 +1,32 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed unread)
+Subject: [notmuch] Working with Maildir storage?
+ Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+  Subject: Re: [notmuch] Working with Maildir storage?
+  To: Mikhail Gusarov <dottedmag@dottedmag.net>
+  Cc: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  [ multipart/mixed ]
+  [ multipart/signed ]
+  [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ]
+  [ text/plain ]
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 4-line signature. Click/Enter to show. ]
+  [ application/pgp-signature ]
+  [ text/plain ]
+  [ 4-line signature. Click/Enter to show. ]
+   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+ Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
deleted file mode 100644
index b31fe62..0000000
--- a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
+++ /dev/null
@@ -1,79 +0,0 @@
-Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-Subject: [notmuch] Working with Maildir storage?
-To: notmuch@notmuchmail.org
-Date: Tue, 17 Nov 2009 14:00:54 -0500
-
-[ multipart/mixed ]
-[ multipart/signed ]
-[ text/plain ]
-I saw the LWN article and decided to take a look at notmuch.  I'm
-currently using mutt and mairix to index and read a collection of
-Maildir mail folders (around 40,000 messages total).
-
-notmuch indexed the messages without complaint, but my attempt at
-searching bombed out. Running, for example:
-
-  notmuch search storage
-
-Resulted in 4604 lines of errors along the lines of:
-
-  Error opening
-  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
-  Too many open files
-
-I'm curious if this is expected behavior (i.e., notmuch does not work
-with Maildir) or if something else is going on.
-
-Cheers,
-
-[ 4-line signature. Click/Enter to show. ]
-[ application/pgp-signature ]
-[ text/plain ]
-[ 4-line signature. Click/Enter to show. ]
- Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
-  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-  Subject: Re: [notmuch] Working with Maildir storage?
-  To: Mikhail Gusarov <dottedmag@dottedmag.net>
-  Cc: notmuch@notmuchmail.org
-  Date: Tue, 17 Nov 2009 15:33:01 -0500
-
-  [ multipart/mixed ]
-  [ multipart/signed ]
-  [ text/plain ]
-  > See the patch just posted here.
-
-  Is the list archived anywhere?  The obvious archives
-  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-  think I subscribed too late to get the patch (I only just saw the
-  discussion about it).
-
-  It doesn't look like the patch is in git yet.
-
-  -- Lars
-
-  [ 4-line signature. Click/Enter to show. ]
-  [ application/pgp-signature ]
-  [ text/plain ]
-  [ 4-line signature. Click/Enter to show. ]
-   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
-   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
-    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
-    Subject: Re: [notmuch] Working with Maildir storage?
-    To: Keith Packard <keithp@keithp.com>
-    Cc: notmuch@notmuchmail.org
-    Date: Tue, 17 Nov 2009 19:50:40 -0500
-
-    [ multipart/mixed ]
-    [ multipart/signed ]
-    [ text/plain ]
-    > I've also pushed a slightly more complicated (and complete) fix to my
-    > private notmuch repository
-
-    The version of lib/messages.cc in your repo doesn't build because it's
-    missing "#include <stdint.h>" (for the uint32_t on line 466).
-
-    [ 4-line signature. Click/Enter to show. ]
-    [ application/pgp-signature ]
-    [ text/plain ]
-    [ 4-line signature. Click/Enter to show. ]
- Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on b/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
deleted file mode 100644
index bafb479..0000000
--- a/test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
+++ /dev/null
@@ -1,75 +0,0 @@
-Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-Subject: [notmuch] Working with Maildir storage?
-To: notmuch@notmuchmail.org
-Date: Tue, 17 Nov 2009 14:00:54 -0500
-
-[ multipart/mixed ]
-[ multipart/signed ]
-[ text/plain ]
-I saw the LWN article and decided to take a look at notmuch.  I'm
-currently using mutt and mairix to index and read a collection of
-Maildir mail folders (around 40,000 messages total).
-
-notmuch indexed the messages without complaint, but my attempt at
-searching bombed out. Running, for example:
-
-  notmuch search storage
-
-Resulted in 4604 lines of errors along the lines of:
-
-  Error opening
-  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
-  Too many open files
-
-I'm curious if this is expected behavior (i.e., notmuch does not work
-with Maildir) or if something else is going on.
-
-Cheers,
-
-[ 4-line signature. Click/Enter to show. ]
-[ application/pgp-signature ]
-[ text/plain ]
-[ 4-line signature. Click/Enter to show. ]
-  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-  Subject: Re: [notmuch] Working with Maildir storage?
-  To: Mikhail Gusarov <dottedmag@dottedmag.net>
-  Cc: notmuch@notmuchmail.org
-  Date: Tue, 17 Nov 2009 15:33:01 -0500
-
-  [ multipart/mixed ]
-  [ multipart/signed ]
-  [ text/plain ]
-  > See the patch just posted here.
-
-  Is the list archived anywhere?  The obvious archives
-  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-  think I subscribed too late to get the patch (I only just saw the
-  discussion about it).
-
-  It doesn't look like the patch is in git yet.
-
-  -- Lars
-
-  [ 4-line signature. Click/Enter to show. ]
-  [ application/pgp-signature ]
-  [ text/plain ]
-  [ 4-line signature. Click/Enter to show. ]
-    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
-    Subject: Re: [notmuch] Working with Maildir storage?
-    To: Keith Packard <keithp@keithp.com>
-    Cc: notmuch@notmuchmail.org
-    Date: Tue, 17 Nov 2009 19:50:40 -0500
-
-    [ multipart/mixed ]
-    [ multipart/signed ]
-    [ text/plain ]
-    > I've also pushed a slightly more complicated (and complete) fix to my
-    > private notmuch repository
-
-    The version of lib/messages.cc in your repo doesn't build because it's
-    missing "#include <stdint.h>" (for the uint32_t on line 466).
-
-    [ 4-line signature. Click/Enter to show. ]
-    [ application/pgp-signature ]
-    [ text/plain ]
-    [ 4-line signature. Click/Enter to show. ]
diff --git a/test/emacs.expected-output/notmuch-show-indent-thread-content-off b/test/emacs.expected-output/notmuch-show-indent-thread-content-off
deleted file mode 100644
index 37b4f7d..0000000
--- a/test/emacs.expected-output/notmuch-show-indent-thread-content-off
+++ /dev/null
@@ -1,79 +0,0 @@
-Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-Subject: [notmuch] Working with Maildir storage?
-To: notmuch@notmuchmail.org
-Date: Tue, 17 Nov 2009 14:00:54 -0500
-
-[ multipart/mixed ]
-[ multipart/signed ]
-[ text/plain ]
-I saw the LWN article and decided to take a look at notmuch.  I'm
-currently using mutt and mairix to index and read a collection of
-Maildir mail folders (around 40,000 messages total).
-
-notmuch indexed the messages without complaint, but my attempt at
-searching bombed out. Running, for example:
-
-  notmuch search storage
-
-Resulted in 4604 lines of errors along the lines of:
-
-  Error opening
-  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
-  Too many open files
-
-I'm curious if this is expected behavior (i.e., notmuch does not work
-with Maildir) or if something else is going on.
-
-Cheers,
-
-[ 4-line signature. Click/Enter to show. ]
-[ application/pgp-signature ]
-[ text/plain ]
-[ 4-line signature. Click/Enter to show. ]
- Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
-  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-Subject: Re: [notmuch] Working with Maildir storage?
-To: Mikhail Gusarov <dottedmag@dottedmag.net>
-Cc: notmuch@notmuchmail.org
-Date: Tue, 17 Nov 2009 15:33:01 -0500
-
-[ multipart/mixed ]
-[ multipart/signed ]
-[ text/plain ]
-> See the patch just posted here.
-
-Is the list archived anywhere?  The obvious archives
-(http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-think I subscribed too late to get the patch (I only just saw the
-discussion about it).
-
-It doesn't look like the patch is in git yet.
-
--- Lars
-
-[ 4-line signature. Click/Enter to show. ]
-[ application/pgp-signature ]
-[ text/plain ]
-[ 4-line signature. Click/Enter to show. ]
-   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
-   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
-    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
-Subject: Re: [notmuch] Working with Maildir storage?
-To: Keith Packard <keithp@keithp.com>
-Cc: notmuch@notmuchmail.org
-Date: Tue, 17 Nov 2009 19:50:40 -0500
-
-[ multipart/mixed ]
-[ multipart/signed ]
-[ text/plain ]
-> I've also pushed a slightly more complicated (and complete) fix to my
-> private notmuch repository
-
-The version of lib/messages.cc in your repo doesn't build because it's
-missing "#include <stdint.h>" (for the uint32_t on line 466).
-
-[ 4-line signature. Click/Enter to show. ]
-[ application/pgp-signature ]
-[ text/plain ]
-[ 4-line signature. Click/Enter to show. ]
- Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
deleted file mode 100644
index 076083a..0000000
--- a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
+++ /dev/null
@@ -1,31 +0,0 @@
-Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-Subject: [notmuch] Working with Maildir storage?
- Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
-  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-  Subject: Re: [notmuch] Working with Maildir storage?
-  To: Mikhail Gusarov <dottedmag@dottedmag.net>
-  Cc: notmuch@notmuchmail.org
-  Date: Tue, 17 Nov 2009 15:33:01 -0500
-
-  [ multipart/mixed ]
-  [ multipart/signed ]
-  [ text/plain ]
-  > See the patch just posted here.
-
-  Is the list archived anywhere?  The obvious archives
-  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-  think I subscribed too late to get the patch (I only just saw the
-  discussion about it).
-
-  It doesn't look like the patch is in git yet.
-
-  -- Lars
-
-  [ 4-line signature. Click/Enter to show. ]
-  [ application/pgp-signature ]
-  [ text/plain ]
-  [ 4-line signature. Click/Enter to show. ]
-   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
-   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
-    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
- Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on b/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
deleted file mode 100644
index 588f38f..0000000
--- a/test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
+++ /dev/null
@@ -1,32 +0,0 @@
-Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-Subject: [notmuch] Working with Maildir storage?
- Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
-  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
-  Subject: Re: [notmuch] Working with Maildir storage?
-  To: Mikhail Gusarov <dottedmag@dottedmag.net>
-  Cc: notmuch@notmuchmail.org
-  Date: Tue, 17 Nov 2009 15:33:01 -0500
-
-  [ multipart/mixed ]
-  [ multipart/signed ]
-  [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ]
-  [ text/plain ]
-  > See the patch just posted here.
-
-  Is the list archived anywhere?  The obvious archives
-  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-  think I subscribed too late to get the patch (I only just saw the
-  discussion about it).
-
-  It doesn't look like the patch is in git yet.
-
-  -- Lars
-
-  [ 4-line signature. Click/Enter to show. ]
-  [ application/pgp-signature ]
-  [ text/plain ]
-  [ 4-line signature. Click/Enter to show. ]
-   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
-   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
-    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
- Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 87+ messages in thread

* Re: [PATCH] test: Move tests from emacs to emacs-show
  2012-10-18  2:16         ` [PATCH] test: Move tests from emacs to emacs-show Ethan Glasser-Camp
@ 2012-10-18 10:19           ` Tomi Ollila
  2012-10-18 12:02           ` David Bremner
  1 sibling, 0 replies; 87+ messages in thread
From: Tomi Ollila @ 2012-10-18 10:19 UTC (permalink / raw)
  To: Ethan Glasser-Camp, notmuch; +Cc: Ethan Glasser-Camp

On Thu, Oct 18 2012, Ethan Glasser-Camp wrote:

> This requires changing the contents of the crypto tests, as one thread
> that was marked read by the earlier tests in test/emacs is no longer
> marked read.
>
> This moves tests for:
>
> - 09d19ac "test: emacs: toggle eliding of non-matching messages in
>    `notmuch-show'", which should have actually read: "test: emacs:
>    toggle processing of cryptographic MIME parts in `notmuch-show'".
>    See commit 19ec74c5.
>
> - 5ea1dbe "test: emacs: toggle eliding of non-matching messages in
>   `notmuch-show'"
>
> - 345faab "test: emacs: toggle thread content indentation in
>   `notmuch-show'"
>
> Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
> ---
> I screwed up with git commit --amend or something on the last patch,
> so David Bremner suggested that I take advantage of the situation to
> write this patch, which does something useful as a side effect.

+1

Tomi

>
>  test/emacs                                         |   67 -----------------
>  test/emacs-show                                    |   71 ++++++++++++++++++
>  .../notmuch-show-elide-non-matching-messages-off   |   79 ++++++++++++++++++++
>  .../notmuch-show-elide-non-matching-messages-on    |   75 +++++++++++++++++++
>  .../notmuch-show-indent-thread-content-off         |   79 ++++++++++++++++++++
>  .../notmuch-show-process-crypto-mime-parts-off     |   31 ++++++++
>  .../notmuch-show-process-crypto-mime-parts-on      |   32 ++++++++
>  .../notmuch-show-elide-non-matching-messages-off   |   79 --------------------
>  .../notmuch-show-elide-non-matching-messages-on    |   75 -------------------
>  .../notmuch-show-indent-thread-content-off         |   79 --------------------
>  .../notmuch-show-process-crypto-mime-parts-off     |   31 --------
>  .../notmuch-show-process-crypto-mime-parts-on      |   32 --------
>  12 files changed, 367 insertions(+), 363 deletions(-)
>  create mode 100644 test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off
>  create mode 100644 test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on
>  create mode 100644 test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
>  create mode 100644 test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off
>  create mode 100644 test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on
>  delete mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-off
>  delete mode 100644 test/emacs.expected-output/notmuch-show-elide-non-matching-messages-on
>  delete mode 100644 test/emacs.expected-output/notmuch-show-indent-thread-content-off
>  delete mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-off
>  delete mode 100644 test/emacs.expected-output/notmuch-show-process-crypto-mime-parts-on
>

^ permalink raw reply	[flat|nested] 87+ messages in thread

* Re: [PATCH] test: Move tests from emacs to emacs-show
  2012-10-18  2:16         ` [PATCH] test: Move tests from emacs to emacs-show Ethan Glasser-Camp
  2012-10-18 10:19           ` Tomi Ollila
@ 2012-10-18 12:02           ` David Bremner
  1 sibling, 0 replies; 87+ messages in thread
From: David Bremner @ 2012-10-18 12:02 UTC (permalink / raw)
  To: Ethan Glasser-Camp, notmuch; +Cc: Ethan Glasser-Camp

Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> writes:

> This requires changing the contents of the crypto tests, as one thread
> that was marked read by the earlier tests in test/emacs is no longer
> marked read.

pushed.

d

^ permalink raw reply	[flat|nested] 87+ messages in thread

end of thread, other threads:[~2012-10-18 12:02 UTC | newest]

Thread overview: 87+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25 10:18 [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles David Edmondson
2012-01-25 10:18 ` [PATCH 1/3] emacs: Rework crypto switch toggle David Edmondson
2012-01-25 10:18 ` [PATCH 2/3] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-01-25 10:18 ` [PATCH 3/3] emacs: Allow the indentation of content to be toggled David Edmondson
2012-01-29 22:30   ` Mark Walters
2012-01-30  9:29     ` David Edmondson
2012-01-30 16:32     ` David Edmondson
2012-01-29 20:06 ` [PATCH 0/3] reworked crypto toggle, plus a couple of other toggles Jameson Graef Rollins
2012-01-30  9:37   ` David Edmondson
2012-01-30 11:26     ` David Edmondson
2012-01-30 17:44       ` Jameson Graef Rollins
2012-01-30 11:31 ` [PATCH 0/3 v2] " David Edmondson
2012-01-30 11:31   ` [PATCH 1/3 v2] emacs: Rework crypto switch toggle David Edmondson
2012-01-30 11:31   ` [PATCH 2/3 v2] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-01-30 11:31   ` [PATCH 3/3 v2] emacs: Allow the indentation of content to be toggled David Edmondson
2012-01-30 16:30 ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles David Edmondson
2012-01-30 16:31   ` [PATCH 1/5] emacs: Rework crypto switch toggle David Edmondson
2012-01-30 16:31   ` [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-01-30 16:31   ` [PATCH 3/5] emacs: Allow the indentation of content to be toggled David Edmondson
2012-01-30 16:31   ` [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines David Edmondson
2012-01-30 17:33     ` Jani Nikula
2012-01-30 17:45       ` David Edmondson
2012-01-30 16:31   ` [PATCH 5/5] emacs: Retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
2012-01-30 20:19     ` Mark Walters
2012-01-31  6:17       ` David Edmondson
2012-01-30 17:03   ` [PATCH 0/5 v3] reworked crypto toggle, plus a few other toggles Tomi Ollila
2012-01-30 17:47   ` Jameson Graef Rollins
2012-01-31  8:09     ` David Edmondson
2012-01-31 16:31       ` Jameson Graef Rollins
2012-01-31 17:01         ` David Edmondson
2012-02-01 14:39 ` [PATCH v5 0/6] " David Edmondson
2012-02-01 14:39   ` [PATCH v5 1/6] emacs: Rework crypto switch toggle David Edmondson
2012-02-01 14:39   ` [PATCH v5 2/6] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-02-01 14:39   ` [PATCH v5 3/6] emacs: Allow the indentation of content to be toggled David Edmondson
2012-02-01 14:39   ` [PATCH v5 4/6] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
2012-02-01 14:39   ` [PATCH v5 5/6] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
2012-02-01 14:39   ` [PATCH v5 6/6] emacs: Check that the parent buffer is alive before using it David Edmondson
2012-02-02 11:23 ` [PATCH v6 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
2012-02-02 11:23   ` [PATCH v6 1/8] emacs: Rework crypto switch toggle David Edmondson
2012-02-03 10:47     ` David Edmondson
2012-02-02 11:23   ` [PATCH v6 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-02-02 11:23   ` [PATCH v6 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
2012-02-02 11:23   ` [PATCH v6 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
2012-02-02 11:23   ` [PATCH v6 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
2012-02-02 11:23   ` [PATCH v6 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
2012-02-02 11:23   ` [PATCH v6 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
2012-02-02 11:23   ` [PATCH v6 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
2012-02-06  9:21 ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
2012-02-06  9:21   ` [PATCH v7 1/8] emacs: Rework crypto switch toggle David Edmondson
2012-02-08  5:10     ` Austin Clements
2012-02-08  6:21       ` David Edmondson
2012-02-06  9:21   ` [PATCH v7 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-02-06  9:21   ` [PATCH v7 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
2012-02-06  9:21   ` [PATCH v7 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
2012-02-06  9:21   ` [PATCH v7 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
2012-02-06  9:21   ` [PATCH v7 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
2012-02-06  9:21   ` [PATCH v7 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
2012-02-06  9:21   ` [PATCH v7 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
2012-02-06 11:32   ` [PATCH v7 0/8] reworked crypto toggle, plus a few other toggles Tomi Ollila
2012-02-08  8:02 ` [PATCH v8 " David Edmondson
2012-02-08  8:02   ` [PATCH v8 1/8] emacs: Rework crypto switch toggle David Edmondson
2012-02-08 14:38     ` Austin Clements
2012-02-08  8:02   ` [PATCH v3 1/2] emacs: Use text properties rather than overlays in `notmuch-show-mode' David Edmondson
2012-02-12 15:47     ` David Bremner
2012-02-08  8:02   ` [PATCH v8 2/8] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
2012-02-08  8:02   ` [PATCH v3 2/2] test: Update test to match previous patch David Edmondson
2012-10-12 20:51     ` Ethan Glasser-Camp
2012-10-14 23:17       ` Jameson Graef Rollins
2012-02-08  8:02   ` [PATCH v8 3/8] emacs: Allow the indentation of content to be toggled David Edmondson
2012-02-08  8:02   ` [PATCH v8 4/8] emacs: Add a binding (t) to toggle the truncation of long lines David Edmondson
2012-02-08  8:02   ` [PATCH v8 5/8] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
2012-02-08  8:02   ` [PATCH v8 6/8] emacs: Check that the parent buffer is alive before using it David Edmondson
2012-02-08  8:02   ` [PATCH v8 7/8] emacs: Add `notmuch-show-only-matching-messages' David Edmondson
2012-02-08  8:02   ` [PATCH v8 8/8] emacs: A prefix argument to `notmuch-show' should invert the matching message behaviour David Edmondson
2012-02-08 19:15   ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles David Edmondson
2012-02-12 17:36   ` David Bremner
2012-02-19 20:56   ` Pieter Praet
2012-02-19 20:56     ` [PATCH 1/3] test: emacs: toggle processing of cryptographic MIME parts in `notmuch-show' Pieter Praet
2012-10-17 23:59       ` [PATCH 1/3] test: emacs: toggle eliding of non-matching messages " Ethan Glasser-Camp
2012-10-18  2:16         ` [PATCH] test: Move tests from emacs to emacs-show Ethan Glasser-Camp
2012-10-18 10:19           ` Tomi Ollila
2012-10-18 12:02           ` David Bremner
2012-02-19 20:56     ` [PATCH 2/3] test: emacs: toggle eliding of non-matching messages in `notmuch-show' Pieter Praet
2012-04-17 17:45       ` Mark Walters
2012-02-19 20:56     ` [PATCH 3/3] test: emacs: toggle thread content indentation " Pieter Praet
2012-10-15 22:17     ` [PATCH v8 0/8] reworked crypto toggle, plus a few other toggles Ethan Glasser-Camp
2012-10-18  0:41       ` David Bremner

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).