From: Mark Walters Date: Wed, 5 Dec 2012 12:20:54 +0000 (+0000) Subject: [PATCH v2] emacs: stash bugfix X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=bad58ad1e0ad17313af6b29559b33304aeabe453;p=notmuch-archives.git [PATCH v2] emacs: stash bugfix --- diff --git a/a7/fbe3ce79e14857d86750b37f010bf6f370220d b/a7/fbe3ce79e14857d86750b37f010bf6f370220d new file mode 100644 index 000000000..91d2c0eff --- /dev/null +++ b/a7/fbe3ce79e14857d86750b37f010bf6f370220d @@ -0,0 +1,98 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CC6B8431FB6 + for ; Wed, 5 Dec 2012 04:21:03 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 z5bhWemH7e1m for ; + Wed, 5 Dec 2012 04:21:03 -0800 (PST) +Received: from mail-we0-f181.google.com (mail-we0-f181.google.com + [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 40EA6431FAE + for ; Wed, 5 Dec 2012 04:21:03 -0800 (PST) +Received: by mail-we0-f181.google.com with SMTP id t11so2420926wey.26 + for ; Wed, 05 Dec 2012 04:21:02 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=PcigKZ42vJY/21M838jqdFbDFDn0yz86MNUYB3m9tvA=; + b=j8xNiFGl4EUo+nHhjgPtb/Eos7yE+QIBsRF75ko+FHLGBNGGOxYrGVEdtm6iqt+Y3N + yDRj5KT8wulu3BnLkhwO08bjZ0lW9jOgOgTxHHttONcZYWKzqeQfWfmpMv50n7Vt5Oos + ltlTTzR4nShfUaNnz6O2G2oLyI+qnXialSpcUH2X7FT5WbCl+B6MVOaa15PgEK6PdZp7 + ndpU4rgsvk6EmCuFfcFpReRi/8OWj6GAF1n9czOul+JqA7pb3JYPSv+njZKCVmv9M4V5 + ZDWuwyVFdPNKDx423Qck1GeXIqLZtq/CdQj7Q3imfDvaj1EFN4a99uat1YNmFaXmggGc + PMRQ== +Received: by 10.180.85.194 with SMTP id j2mr2860308wiz.12.1354710062152; + Wed, 05 Dec 2012 04:21:02 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id p2sm6170537wic.7.2012.12.05.04.21.00 + (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 05 Dec 2012 04:21:01 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2] emacs: stash bugfix +Date: Wed, 5 Dec 2012 12:20:54 +0000 +Message-Id: <1354710054-23093-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <20121203152015.GD1020@mit.edu> +References: <20121203152015.GD1020@mit.edu> +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: Wed, 05 Dec 2012 12:21:03 -0000 + +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. +--- + +This fixes the comment and stashes an empty string in the +case there is nothing to stash (both suggested by Austin). + + + emacs/notmuch-lib.el | 10 ++++++++-- + 1 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index 1d0ec17..5c44867 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -183,8 +183,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!"))) + + ;; + +-- +1.7.9.1 +