From: Mark Walters <markwalters1009@gmail.com>
To: Servilio Afre Puentes <servilio@gmail.com>,
notmuch <notmuch@notmuchmail.org>
Subject: Re: [PATCH 2/2] emacs: hello: allow deleting individual searches in the history
Date: Sun, 05 May 2013 00:31:18 +0100 [thread overview]
Message-ID: <87zjwafhkp.fsf@qmul.ac.uk> (raw)
In-Reply-To: <87sj24kksc.fsf@goose.CSU.McMaster.CA>
These patches both look good to me (and the lisp all looks fine) modulo
a trivial style comment and a little bikeshedding.
For the bikeshedding I would prefer that the first patch was a y-or-n-p
(as Jani suggested) and that the second didn't query at all (the
dataloss potential from deleting a single search from the history is
pretty small)
On Fri, 03 May 2013, Servilio Afre Puentes <servilio@gmail.com> wrote:
> This commit adds an extra button at the end of the search entries that
> allows deleting that individual search from the history. A short
> confirmation («y» or «n») is made before taking action.
> ---
> emacs/notmuch-hello.el | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index aa063b7..9fbbdc9 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -286,6 +286,16 @@ afterwards.")
> (message "Saved '%s' as '%s'." search name)
> (notmuch-hello-update)))
>
> +(defun notmuch-hello-delete-search-from-history (widget)
> + (interactive)
> + (let ((search (widget-value
> + (symbol-value
> + (widget-get widget :notmuch-saved-search-widget)))))
> + (setq notmuch-search-history (delete search
> + notmuch-search-history))
> + (notmuch-hello-update)
> + ))
> +
Trivial formatting/style point: notmuch goes for putting all the braces
after the final function.
Best wishes
Mark
> (defun notmuch-hello-longest-label (searches-alist)
> (or (loop for elem in searches-alist
> maximize (length (car elem)))
> @@ -624,7 +634,12 @@ Complete list of currently available key bindings:
> ;; `[save]' button. 6
> ;; for the `[save]'
> ;; button.
> - 1 6))
> + 1 6
> + ;; 1 for the space
> + ;; before the `[del]'
> + ;; button. 5 for the
> + ;; `[del]' button.
> + 1 5))
> :action (lambda (widget &rest ignore)
> (notmuch-hello-search (widget-value widget)))
> search))
> @@ -633,7 +648,14 @@ Complete list of currently available key bindings:
> :notify (lambda (widget &rest ignore)
> (notmuch-hello-add-saved-search widget))
> :notmuch-saved-search-widget widget-symbol
> - "save"))
> + "save")
> + (widget-insert " ")
> + (widget-create 'push-button
> + :notify (lambda (widget &rest ignore)
> + (when (y-or-n-p "Are you sure you want to delete this search? ")
> + (notmuch-hello-delete-search-from-history widget)))
> + :notmuch-saved-search-widget widget-symbol
> + "del"))
> (widget-insert "\n"))
> (indent-rigidly start (point) notmuch-hello-indent))
> nil))
> --
> 1.8.2.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2013-05-04 23:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 17:19 [PATCH 0/2] Enhancements to notmuch-hello search history Servilio Afre Puentes
2013-05-03 17:57 ` [PATCH 1/2] emacs: hello: ask confirmation for clearing recent searches Servilio Afre Puentes
2013-05-03 17:58 ` [PATCH 2/2] emacs: hello: allow deleting individual searches in the history Servilio Afre Puentes
2013-05-04 23:31 ` Mark Walters [this message]
2013-05-04 8:54 ` [PATCH 0/2] Enhancements to notmuch-hello search history Jani Nikula
2013-05-04 16:12 ` Servilio Afre Puentes
2013-05-05 9:58 ` Tomi Ollila
2013-05-05 12:45 ` Jani Nikula
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=87zjwafhkp.fsf@qmul.ac.uk \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
--cc=servilio@gmail.com \
/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).