* [PATCH 1/5] emacs: Rework crypto switch toggle.
2012-01-31 8:46 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
@ 2012-01-31 8:46 ` David Edmondson
2012-01-31 8:46 ` [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
` (4 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: David Edmondson @ 2012-01-31 8:46 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 de9421e..35a2809 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -125,6 +125,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
@@ -411,14 +422,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 +608,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 +634,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 +761,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 +914,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 +938,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 +957,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,24 +972,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)
@@ -991,8 +993,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))
@@ -1022,21 +1022,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)))
@@ -1087,6 +1081,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] 14+ messages in thread
* [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages.
2012-01-31 8:46 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
2012-01-31 8:46 ` [PATCH 1/5] emacs: Rework crypto switch toggle David Edmondson
@ 2012-01-31 8:46 ` David Edmondson
2012-01-31 8:46 ` [PATCH 3/5] emacs: Allow the indentation of content to be toggled David Edmondson
` (3 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: David Edmondson @ 2012-01-31 8:46 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 35a2809..77ba2dd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -136,6 +136,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
@@ -923,11 +927,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)
@@ -1081,6 +1096,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] 14+ messages in thread
* [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
2012-01-31 8:46 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
2012-01-31 8:46 ` [PATCH 1/5] emacs: Rework crypto switch toggle David Edmondson
2012-01-31 8:46 ` [PATCH 2/5] emacs: Allow `notmuch-show-mode' to display only matching messages David Edmondson
@ 2012-01-31 8:46 ` David Edmondson
2012-01-31 16:15 ` Mark Walters
2012-01-31 8:46 ` [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines David Edmondson
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: David Edmondson @ 2012-01-31 8:46 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 77ba2dd..789b6d9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -140,6 +140,10 @@ indentation."
(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
(put 'notmuch-show-elide-non-matching-messages 'permanent-local t)
+(defvar notmuch-show-indent-content t)
+(make-variable-buffer-local 'notmuch-show-indent-content)
+(put 'notmuch-show-indent-content 'permanent-local t)
+
(defmacro with-current-notmuch-show-message (&rest body)
"Evaluate body with current buffer set to the text of current message"
`(save-excursion
@@ -250,10 +254,12 @@ operation on the contents of the current buffer."
(all (buffer-substring (notmuch-show-message-top)
(notmuch-show-message-bottom)))
- (props (notmuch-show-get-message-properties)))
+ (props (notmuch-show-get-message-properties))
+ (indenting notmuch-show-indent-content))
(with-temp-buffer
(insert all)
- (indent-rigidly (point-min) (point-max) (- depth))
+ (if indenting
+ (indent-rigidly (point-min) (point-max) (- depth)))
;; Remove the original header.
(goto-char (point-min))
(re-search-forward "^$" (point-max) nil)
@@ -881,7 +887,8 @@ current buffer, if possible."
(setq notmuch-show-previous-subject bare-subject)
(setq body-start (point-marker))
- (notmuch-show-insert-body msg (plist-get msg :body) depth)
+ (notmuch-show-insert-body msg (plist-get msg :body)
+ (if notmuch-show-indent-content depth 0))
;; Ensure that the body ends with a newline.
(unless (bolp)
(insert "\n"))
@@ -889,7 +896,8 @@ current buffer, if possible."
(setq content-end (point-marker))
;; Indent according to the depth in the thread.
- (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth))
+ (if notmuch-show-indent-content
+ (indent-rigidly content-start content-end (* notmuch-show-indent-messages-width depth)))
(setq message-end (point-max-marker))
@@ -936,6 +944,15 @@ current buffer, if possible."
"Showing all messages."))
(notmuch-show-refresh-view))
+(defun notmuch-show-toggle-thread-indentation ()
+ "Toggle the indentation of threads."
+ (interactive)
+ (setq notmuch-show-indent-content (not notmuch-show-indent-content))
+ (message (if notmuch-show-indent-content
+ "Content is indented."
+ "Content is not indented."))
+ (notmuch-show-refresh-view))
+
(defun notmuch-show-insert-tree (tree depth)
"Insert the message tree TREE at depth DEPTH in the current thread."
(let ((msg (car tree))
@@ -1098,6 +1115,7 @@ Refreshes the current view, observing changes in cryptographic preferences."
(define-key map "#" 'notmuch-show-print-message)
(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
(define-key map "$" 'notmuch-show-toggle-process-crypto)
+ (define-key map "<" 'notmuch-show-toggle-thread-indentation)
map)
"Keymap for \"notmuch show\" buffers.")
(fset 'notmuch-show-mode-map notmuch-show-mode-map)
--
1.7.8.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
2012-01-31 8:46 ` [PATCH 3/5] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-01-31 16:15 ` Mark Walters
2012-01-31 16:23 ` David Edmondson
0 siblings, 1 reply; 14+ messages in thread
From: Mark Walters @ 2012-01-31 16:15 UTC (permalink / raw)
To: David Edmondson, notmuch
Hi I have reviewed the patch series within the limits of my lisp
knowledge. Patch 1: is rather beyond my lisp so I won't comment on that
(and I have never tried crypto): Patches 2-5 look fine with one
bikeshed and one query for my own understanding.
The bikeshed is that I agree with Jani in
id:"CAB+hUn8KhXHTRCdrLe0cT=8mdtz9ZntPFf13mq0iCo4CX=B-Jg@mail.gmail.com"
that I would prefer to reserve '>' for saving a file.
The query: in
> + (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)))
Is the local variable `indenting' needed because
notmuch-show-indent-content is buffer local and this is in the
with-temp-buffer?
Thanks
Mark
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
2012-01-31 16:15 ` Mark Walters
@ 2012-01-31 16:23 ` David Edmondson
2012-01-31 23:50 ` Mark Walters
0 siblings, 1 reply; 14+ messages in thread
From: David Edmondson @ 2012-01-31 16:23 UTC (permalink / raw)
To: Mark Walters, notmuch
[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]
On Tue, 31 Jan 2012 16:15:11 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> Hi I have reviewed the patch series within the limits of my lisp
> knowledge. Patch 1: is rather beyond my lisp so I won't comment on that
> (and I have never tried crypto): Patches 2-5 look fine with one
> bikeshed and one query for my own understanding.
Thanks.
> The bikeshed is that I agree with Jani in
> id:"CAB+hUn8KhXHTRCdrLe0cT=8mdtz9ZntPFf13mq0iCo4CX=B-Jg@mail.gmail.com"
> that I would prefer to reserve '>' for saving a file.
'<' is 'remove indent', or 'look to the left'.
'>' is 'toggle truncation', or 'look to the right'.
(I'm not overly worried about this - would 't' be more acceptable?)
> The query: in
>
> > + (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)))
>
> Is the local variable `indenting' needed because
> notmuch-show-indent-content is buffer local and this is in the
> with-temp-buffer?
Yes.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
2012-01-31 16:23 ` David Edmondson
@ 2012-01-31 23:50 ` Mark Walters
2012-02-01 8:52 ` Tomi Ollila
0 siblings, 1 reply; 14+ messages in thread
From: Mark Walters @ 2012-01-31 23:50 UTC (permalink / raw)
To: David Edmondson, notmuch
On Tue, 31 Jan 2012 16:23:32 +0000, David Edmondson <dme@dme.org> wrote:
> On Tue, 31 Jan 2012 16:15:11 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> > Hi I have reviewed the patch series within the limits of my lisp
> > knowledge. Patch 1: is rather beyond my lisp so I won't comment on that
> > (and I have never tried crypto): Patches 2-5 look fine with one
> > bikeshed and one query for my own understanding.
>
> Thanks.
>
> > The bikeshed is that I agree with Jani in
> > id:"CAB+hUn8KhXHTRCdrLe0cT=8mdtz9ZntPFf13mq0iCo4CX=B-Jg@mail.gmail.com"
> > that I would prefer to reserve '>' for saving a file.
>
> '<' is 'remove indent', or 'look to the left'.
> '>' is 'toggle truncation', or 'look to the right'.
>
> (I'm not overly worried about this - would 't' be more acceptable?)
I personally would prefer 't' but it is easy to remap so it really isn't
important.
Best wishes
Mark
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/5] emacs: Allow the indentation of content to be toggled.
2012-01-31 23:50 ` Mark Walters
@ 2012-02-01 8:52 ` Tomi Ollila
0 siblings, 0 replies; 14+ messages in thread
From: Tomi Ollila @ 2012-02-01 8:52 UTC (permalink / raw)
To: Mark Walters, David Edmondson, notmuch
On Tue, 31 Jan 2012 23:50:06 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> On Tue, 31 Jan 2012 16:23:32 +0000, David Edmondson <dme@dme.org> wrote:
> > On Tue, 31 Jan 2012 16:15:11 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> > > Hi I have reviewed the patch series within the limits of my lisp
> > > knowledge. Patch 1: is rather beyond my lisp so I won't comment on that
> > > (and I have never tried crypto): Patches 2-5 look fine with one
> > > bikeshed and one query for my own understanding.
> >
> > Thanks.
> >
> > > The bikeshed is that I agree with Jani in
> > > id:"CAB+hUn8KhXHTRCdrLe0cT=8mdtz9ZntPFf13mq0iCo4CX=B-Jg@mail.gmail.com"
> > > that I would prefer to reserve '>' for saving a file.
> >
> > '<' is 'remove indent', or 'look to the left'.
> > '>' is 'toggle truncation', or 'look to the right'.
> >
> > (I'm not overly worried about this - would 't' be more acceptable?)
>
> I personally would prefer 't' but it is easy to remap so it really isn't
> important.
Anything goes. 't' is easier than '>'...
As a previous vm/gnus user iirc 't' toggles headers and 'o' outputs file
there. If we paid attention to these 2 and rmail and mew and mh-e we
could figure out compatible keybindings where usable/appripriate...
... I think I just assigned this check to me...
>
> Best wishes
>
> Mark
Tomi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines.
2012-01-31 8:46 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
` (2 preceding siblings ...)
2012-01-31 8:46 ` [PATCH 3/5] emacs: Allow the indentation of content to be toggled David Edmondson
@ 2012-01-31 8:46 ` David Edmondson
2012-01-31 8:47 ` [PATCH 5/5] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
2012-01-31 8:55 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
5 siblings, 0 replies; 14+ messages in thread
From: David Edmondson @ 2012-01-31 8:46 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 789b6d9..28f2148 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1116,6 +1116,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] 14+ messages in thread
* [PATCH 5/5] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view'.
2012-01-31 8:46 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
` (3 preceding siblings ...)
2012-01-31 8:46 ` [PATCH 4/5] emacs: Add a binding (>) to toggle the truncation of long lines David Edmondson
@ 2012-01-31 8:47 ` David Edmondson
2012-01-31 8:55 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
5 siblings, 0 replies; 14+ messages in thread
From: David Edmondson @ 2012-01-31 8:47 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 | 58 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 28f2148..2f10c42 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -933,7 +933,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."
@@ -942,7 +942,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."
@@ -951,7 +951,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."
@@ -1054,15 +1054,55 @@ 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 notmuch-show-thread-id notmuch-show-parent-buffer
- notmuch-show-query-context))
+ (let ((inhibit-read-only t)
+ state)
+ (if retain-state
+ (setq state (notmuch-show-capture-state)))
+ (erase-buffer)
+ (notmuch-show-worker notmuch-show-thread-id notmuch-show-parent-buffer
+ notmuch-show-query-context)
+ (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] 14+ messages in thread
* Re: [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles
2012-01-31 8:46 ` [PATCH 0/5 v4] reworked crypto toggle, plus a few other toggles David Edmondson
` (4 preceding siblings ...)
2012-01-31 8:47 ` [PATCH 5/5] emacs: Optionally retain the state of the buffer during `notmuch-show-refresh-view' David Edmondson
@ 2012-01-31 8:55 ` David Edmondson
5 siblings, 0 replies; 14+ messages in thread
From: David Edmondson @ 2012-01-31 8:55 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 157 bytes --]
I mangled the "in-reply-to" header, which should be
1327486729-18052-1-git-send-email-dme@dme.org
(i.e. id:"1327486729-18052-1-git-send-email-dme@dme.org").
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread