X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=emacs%2Fnotmuch-address.el;h=d372fbafab001f7931a98eeef1c12d074dfa38a5;hb=6a833a6e83865f6999707cc30768d07e1351c2cb;hp=49e240236c7a439d87640c4fdd2b8102446298e9;hpb=ca076ce2736b5db2ec03afe1b0e09299b24f05ff;p=notmuch
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 49e24023..d372fbaf 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -1,4 +1,4 @@
-;; notmuch-address.el --- address completion with notmuch
+;;; notmuch-address.el --- address completion with notmuch
;;
;; Copyright © David Edmondson
;;
@@ -15,10 +15,12 @@
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
-;; along with Notmuch. If not, see .
+;; along with Notmuch. If not, see .
;;
;; Authors: David Edmondson
+;;; Code:
+
(require 'message)
(require 'notmuch-parser)
(require 'notmuch-lib)
@@ -247,4 +249,25 @@ called when harvesting finishes."
;;
+(defun notmuch-address-from-minibuffer (prompt)
+ (if (not notmuch-address-command)
+ (read-string prompt)
+ (let ((rmap (copy-keymap minibuffer-local-map))
+ (omap minibuffer-local-map))
+ ;; Configure TAB to start completion when executing read-string.
+ ;; "Original" minibuffer keymap is restored just before calling
+ ;; notmuch-address-expand-name as it may also use minibuffer-local-map
+ ;; (completing-read probably does not but if something else is used there).
+ (define-key rmap (kbd "TAB") (lambda ()
+ (interactive)
+ (let ((enable-recursive-minibuffers t)
+ (minibuffer-local-map omap))
+ (notmuch-address-expand-name))))
+ (let ((minibuffer-local-map rmap))
+ (read-string prompt)))))
+
+;;
+
(provide 'notmuch-address)
+
+;;; notmuch-address.el ends here