From 5382eebcdcdb50625c038c6caa89968d2f403bd1 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 5 Dec 2012 12:20:54 +0000 Subject: [PATCH] emacs: stash bugfix 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. --- emacs/notmuch-lib.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 3e8647db..9c4ee718 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -168,8 +168,14 @@ 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)) + ;; There is nothing to stash so stash an empty string so the user + ;; doesn't accidentally paste something else somewhere. + (kill-new "") + (message "Nothing to stash!"))) ;; -- 2.45.2