[PATCH v1] emacs: Add `notmuch-show-toggle-citation-visibility', bound to '>'
Mark Walters
markwalters1009 at gmail.com
Thu May 22 00:51:32 PDT 2014
On Tue, 20 May 2014, David Edmondson <dme at dme.org> wrote:
> Add a function and key-binding to toggle the collapsing of citations
> within the current message.
Hi
I like the idea. It seems a little odd to want to toggle the citations
closing some and opening others. I wonder whether the following action
would be more intuitive.
If any citation is closed then open all citations. Otherwise close all
citations.
Alternatively, we could mirror things like M-RET and have ">" always opens
citations and PREFIX ">" always closes all citations.
What do you think?
Best wishes
Mark
> ---
> emacs/notmuch-show.el | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 10fc872..e4b56c7 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1036,6 +1036,22 @@ useful for quoting in replies)."
> "Content is not indented."))
> (notmuch-show-refresh-view))
>
> +(defun notmuch-show-toggle-citation-visibility ()
> + "Toggle the visibility of the citations in the current message."
> + (interactive)
> + (let ((beg (notmuch-show-message-top))
> + (end (notmuch-show-message-bottom))
> + button)
> + (save-excursion
> + (goto-char beg)
> + (while (and (setq button (next-button (point)))
> + (< (goto-char (button-start button))
> + end))
> + (let ((overlay (button-get button 'overlay)))
> + (when (and overlay
> + (string= (overlay-get overlay 'type) "citation"))
> + (push-button (point))))))))
> +
> (defun notmuch-show-insert-tree (tree depth)
> "Insert the message tree TREE at depth DEPTH in the current thread."
> (let ((msg (car tree))
> @@ -1311,6 +1327,7 @@ reset based on the original query."
> (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 ">" 'notmuch-show-toggle-citation-visibility)
> (define-key map "t" 'toggle-truncate-lines)
> (define-key map "." 'notmuch-show-part-map)
> map)
> --
> 2.0.0.rc0
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
More information about the notmuch
mailing list