unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: Mark Walters <markwalters1009@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: stash bugfix
Date: Mon, 3 Dec 2012 10:20:15 -0500	[thread overview]
Message-ID: <20121203152015.GD1020@mit.edu> (raw)
In-Reply-To: <87ehj71o4i.fsf@qmul.ac.uk>

Quoth Mark Walters on Dec 03 at  9:27 am:
> 
> On Mon, 03 Dec 2012, Austin Clements <amdragon@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).

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.

  reply	other threads:[~2012-12-03 15:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-02 10:11 [PATCH] emacs: stash bugfix Mark Walters
2012-12-02 11:04 ` Tomi Ollila
2012-12-03  1:34 ` Austin Clements
2012-12-03  9:27   ` Mark Walters
2012-12-03 15:20     ` Austin Clements [this message]
2012-12-05 12:20       ` [PATCH v2] " Mark Walters
2012-12-05 16:01         ` Austin Clements
2012-12-06 21:25         ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121203152015.GD1020@mit.edu \
    --to=amdragon@mit.edu \
    --cc=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).