[PATCH] emacs: stash bugfix

Mark Walters markwalters1009 at gmail.com
Mon Dec 3 01:27:57 PST 2012


On Mon, 03 Dec 2012, Austin Clements <amdragon at MIT.EDU> wrote:
> Quoth Mark Walters on Dec 02 at 10:11 am:
>> Currently an attempt to stash a non-existent field (eg cc when not
>> present) throws an error. Catch this case and give the user a warning
>> message.
>> 
>> ---
>> While messing around with notmuch-pick key bindings I found the
>> following bug. The easiest way I have found to trigger it is cc
>> (stash-cc) in show mode on a message with no cc header.
>> 
>> Best wishes
>> 
>> Mark
>> 
>>  emacs/notmuch-lib.el |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
>> index 1d0ec17..c7d8e02 100644
>> --- a/emacs/notmuch-lib.el
>> +++ b/emacs/notmuch-lib.el
>> @@ -183,8 +183,11 @@ user-friendly queries."
>>  
>>  (defun notmuch-common-do-stash (text)
>>    "Common function to stash text in kill ring, and display in minibuffer."
>> -  (kill-new text)
>> -  (message "Stashed: %s" text))
>> +  (if text
>> +      (progn
>> +	(kill-new text)
>> +	(message "Stashed: %s" text))
>> +    (message "Warning: Nothing to stash!")))
>
> Without the unnecessary "Warning:" bit of the message, LGTM.

I am obviously happy to remove the "warning": however do you think
stashing a non-existent thing should empty the kill-ring? I am a little
worried about someone stashing something, not noticing the "nothing to
stash" and then pasting some random thing somewhere (eg something
private into irc).

Best wishes

Mark


More information about the notmuch mailing list