]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: stash bugfix
authorMark Walters <markwalters1009@gmail.com>
Wed, 5 Dec 2012 12:20:54 +0000 (12:20 +0000)
committerDavid Bremner <bremner@debian.org>
Thu, 6 Dec 2012 21:12:47 +0000 (17:12 -0400)
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

index 3e8647db78c8710e7d3bb0926e8b52729866b3ac..9c4ee71811ed8e91b8378c96d2601533e39c5ad7 100644 (file)
@@ -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!")))
 
 ;;