From: Austin Clements Date: Thu, 24 Oct 2013 21:30:27 +0000 (-0400) Subject: emacs: Add a space after completed tag operations X-Git-Tag: 0.17_rc1~90 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9f9a63c863e2eac1adebef16a103d7bc0ccdc291;p=notmuch.git emacs: Add a space after completed tag operations Previously, when a user fully completed a tag operation, they had to press space to begin entering another tag operation. This is different from, say, shell file name completion, which typically inserts a space after an unambiguous completion under the assumption that the user will want to enter more input. This patch tweaks `notmuch-read-tag-changes' to act more like shell file name completion: after an unambiguous tag completion, it now inserts a space, ready and waiting for another tagging operation from the user. This is backwards-compatible with old habits, since there's no harm in putting an extra space. --- diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 22a603fc..f705ac5d 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -230,8 +230,16 @@ initial input in the minibuffer." (set-keymap-parent map crm-local-completion-map) (define-key map " " 'self-insert-command) map))) - (delete "" (completing-read-multiple prompt - tag-list nil nil initial-input + (delete "" (completing-read-multiple + prompt + ;; Append the separator to each completion so when the + ;; user completes a tag they can immediately begin + ;; entering another. `completing-read-multiple' + ;; ultimately splits the input on crm-separator, so we + ;; don't need to strip this back off (we just need to + ;; delete "empty" entries caused by trailing spaces). + (mapcar (lambda (tag-op) (concat tag-op crm-separator)) tag-list) + nil nil initial-input 'notmuch-read-tag-changes-history)))) (defun notmuch-update-tags (tags tag-changes)