From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 0/2] emacs: Shortcut keys to saved searches
Date: Tue, 15 Jul 2014 10:06:04 -0400 [thread overview]
Message-ID: <1405433166-2198-1-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1405353735-26244-1-git-send-email-amdragon@mit.edu>
This is version 2 of
id:1405353735-26244-1-git-send-email-amdragon@mit.edu and addresses
Mark's comments in id:87egxnd4aq.fsf@qmul.ac.uk.
The diff from v1 is below.
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index cb1ae10..9cb1e6a 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -53,20 +53,19 @@ (defun notmuch-jump-search ()
(setq action-map (nreverse action-map))
(if action-map
- (notmuch-jump action-map "Search ")
- (error "No shortcut keys for saved searches. Please customize notmuch-saved-searches."))))
+ (notmuch-jump action-map "Search: ")
+ (error "To use notmuch-jump, please customize shortcut keys in notmuch-saved-searches."))))
(defvar notmuch-jump--action nil)
(defun notmuch-jump (action-map prompt)
"Interactively prompt for one of the keys in ACTION-MAP.
-Displays a pop-up temporary buffer with a summary of all bindings
-in ACTION-MAP, reads a key from the minibuffer, and performs the
-corresponding action. The prompt can be canceled with C-g.
-PROMPT must be a string to use for the prompt if this command was
-not invoked directly by a key binding (e.g., it was invoked
-through M-x). PROMPT should include a space at the end.
+Displays a summary of all bindings in ACTION-MAP in the
+minibuffer, reads a key from the minibuffer, and performs the
+corresponding action. The prompt can be canceled with C-g or
+RET. PROMPT must be a string to use for the prompt. PROMPT
+should include a space at the end.
ACTION-MAP must be a list of triples of the form
(KEY LABEL ACTION)
@@ -82,16 +81,9 @@ (defun notmuch-jump (action-map prompt)
(with-temp-buffer
(notmuch-jump--insert-items (window-body-width) items)
(buffer-string)))
- (prompt-text
- (if (eq this-original-command this-command)
- ;; Make it look like we're just part of any regular
- ;; submap prompt (like C-x, C-c, etc.)
- (concat (format-kbd-macro (this-command-keys)) "-")
- ;; We were invoked through something like M-x
- prompt))
(full-prompt
(concat table "\n\n"
- (propertize prompt-text 'face 'minibuffer-prompt)))
+ (propertize prompt 'face 'minibuffer-prompt)))
;; By default, the minibuffer applies the minibuffer face to
;; the entire prompt. However, we want to clearly
;; distinguish bindings (which we put in the prompt face
@@ -121,14 +113,14 @@ (defun notmuch-jump--format-actions (action-map)
;; Compute the maximum key description width
(let ((key-width 1))
- (dolist (action action-map)
+ (dolist (entry action-map)
(setq key-width
(max key-width
- (string-width (format-kbd-macro (first action))))))
+ (string-width (format-kbd-macro (first entry))))))
;; Format each action
- (mapcar (lambda (action)
- (let ((key (format-kbd-macro (first action)))
- (desc (second action)))
+ (mapcar (lambda (entry)
+ (let ((key (format-kbd-macro (first entry)))
+ (desc (second entry)))
(concat
(propertize key 'face 'minibuffer-prompt)
(make-string (- key-width (length key)) ? )
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 135422d..b338aaa 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -25,6 +25,9 @@
(require 'mm-decode)
(require 'cl)
+(autoload 'notmuch-jump-search "notmuch-jump"
+ "Jump to a saved search by shortcut key." t)
+
(defvar notmuch-command "notmuch"
"Command to run the notmuch binary.")
@@ -134,8 +137,6 @@ (defvar notmuch-common-keymap
map)
"Keymap shared by all notmuch modes.")
-(autoload 'notmuch-jump-search "notmuch-jump" "Jump to a saved search by shortcut key." t)
-
;; By default clicking on a button does not select the window
;; containing the button (as opposed to clicking on a widget which
;; does). This means that the button action is then executed in the
next prev parent reply other threads:[~2014-07-15 14:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 16:02 [PATCH 0/2] emacs: Shortcut keys to saved searches Austin Clements
2014-07-14 16:02 ` [PATCH 1/2] emacs: Introduce notmuch-jump: shortcut " Austin Clements
2014-07-14 21:22 ` Mark Walters
2014-07-15 3:46 ` Austin Clements
2014-07-15 7:02 ` Mark Walters
2014-07-14 16:02 ` [PATCH 2/2] emacs: Expand default saved searches and add shortcut keys Austin Clements
2014-07-15 14:06 ` Austin Clements [this message]
2014-07-15 14:06 ` [PATCH v2 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches Austin Clements
2014-08-04 23:00 ` David Bremner
2014-08-05 1:44 ` Austin Clements
2014-08-05 1:45 ` [PATCH v3 " Austin Clements
2014-08-05 1:45 ` [PATCH v3 2/2] emacs: Expand default saved searches and add shortcut keys Austin Clements
2014-08-05 11:20 ` [PATCH v3 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches David Bremner
2014-07-15 14:06 ` [PATCH v2 2/2] emacs: Expand default saved searches and add shortcut keys Austin Clements
2014-07-15 22:06 ` David Bremner
2014-07-15 20:18 ` [PATCH v2 0/2] emacs: Shortcut keys to saved searches Mark Walters
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=1405433166-2198-1-git-send-email-amdragon@mit.edu \
--to=amdragon@mit.edu \
--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).