]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-address.el
Use https instead of http where possible
[notmuch] / emacs / notmuch-address.el
index 49e240236c7a439d87640c4fdd2b8102446298e9..d372fbafab001f7931a98eeef1c12d074dfa38a5 100644 (file)
@@ -1,4 +1,4 @@
-;; notmuch-address.el --- address completion with notmuch
+;;; notmuch-address.el --- address completion with notmuch
 ;;
 ;; Copyright © David Edmondson
 ;;
 ;; General Public License for more details.
 ;;
 ;; You should have received a copy of the GNU General Public License
-;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;; along with Notmuch.  If not, see <https://www.gnu.org/licenses/>.
 ;;
 ;; Authors: David Edmondson <dme@dme.org>
 
+;;; 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