[PATCH v1] emacs: Add `notmuch-show-toggle-citation-visibility', bound to '>'

David Edmondson dme at dme.org
Thu May 22 01:22:42 PDT 2014


On Thu, May 22 2014, Mark Walters wrote:
> 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.

Toggle is a side-effect of the implementation, I agree.

> 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?

I'll do this. (Busy next week, so it won't be immediate.)

> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 310 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140522/692c2b0c/attachment.pgp>


More information about the notmuch mailing list