From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 15831431FB6 for ; Mon, 3 Dec 2012 07:20:20 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WLGvQGVnEqW4 for ; Mon, 3 Dec 2012 07:20:19 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id 6C377431FAE for ; Mon, 3 Dec 2012 07:20:19 -0800 (PST) X-AuditID: 12074423-b7fcb6d000000927-69-50bcc3321074 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id 0C.5C.02343.233CCB05; Mon, 3 Dec 2012 10:20:18 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qB3FKINQ023577; Mon, 3 Dec 2012 10:20:18 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qB3FKF1S011384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 3 Dec 2012 10:20:16 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1TfXod-000251-HB; Mon, 03 Dec 2012 10:20:15 -0500 Date: Mon, 3 Dec 2012 10:20:15 -0500 From: Austin Clements To: Mark Walters Subject: Re: [PATCH] emacs: stash bugfix Message-ID: <20121203152015.GD1020@mit.edu> References: <1354443068-5030-1-git-send-email-markwalters1009@gmail.com> <20121203013402.GC1020@mit.edu> <87ehj71o4i.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ehj71o4i.fsf@qmul.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IRYrdT1zU6vCfAYOEaC4vVc3ksrt+cyezA 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZcz8/pypYINAxa1jt9gaGD/wdDFyckgImEi8 XbKeDcIWk7hwD8Tm4hAS2McocfXZThYIZz2jRNPtaYwQzgUmiRULOtkhnCWMEo/+d7OD9LMI qEjMOfoCbBabgIbEtv3LGUFsEQEdiduHFoDVMAtIS3z73cwEYgsD1Ry/dAOsnldAW2Ll8tXM EEM7GCU2Pb7DCJEQlDg58wkLRLOWxI1/L4GaOcAGLf/HARLmBJqzZ9JZZhBbFOiGKSe3sU1g FJqFpHsWku5ZCN0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Zrp5WaW6KWmlG5iBAe2i/IO xj8HlQ4xCnAwKvHwPviyO0CINbGsuDL3EKMkB5OSKC/j5j0BQnxJ+SmVGYnFGfFFpTmpxYcY JTiYlUR4d24EyvGmJFZWpRblw6SkOViUxHmvpdz0FxJITyxJzU5NLUgtgsnKcHAoSfCKHgJq FCxKTU+tSMvMKUFIM3FwggznARquDVLDW1yQmFucmQ6RP8WoKCXOywSSEABJZJTmwfXCEs8r RnGgV4R5uUGqeIBJC677FdBgJqDBL4R2gwwuSURISTUwTvlx7+YNYZE79jN39Wfuuegex7Wt Jptlv/nc794hWiUJzJOnrOE841B06Mritc1znzwR9MnxNL1l82B6zcZzolcWRv/i7fz+8Jvb YQn+hsu+p1imznqUHL2HaZdp4J5+QfMDH7fdWxaxflVi5a6I+ffss0QzeCYpTfq/+UEyp6tW 585PZn1KbkosxRmJhlrMRcWJAFVRvjQXAwAA Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2012 15:20:20 -0000 Quoth Mark Walters on Dec 03 at 9:27 am: > > On Mon, 03 Dec 2012, Austin Clements 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). Mm, interesting. I don't think you want to empty the kill-ring because there may be useful things earlier in it. You could clear out the window system selection directly, but that's probably flaky and doesn't help if you're copying around within Emacs. What about (kill-new "")? Then the function would always put something on the kill-ring (and clipboard/selection/whatever) but it would be harmless if there was nothing to stash.