[PATCH 1/1] emacs: initialize ido(-completing-read) in emacs 23.[123]

Tomi Ollila tomi.ollila at iki.fi
Mon Jan 27 12:23:37 PST 2014


Otherwise `ido-completing-read' will freeze after PROMPT is displayed.
---

I tested this on emacs 23.1 & 24.3.

I also tested this by adding (sit-for 2.0) inside the advice -- this
lead to the addition of (ad-activate 'ido-completing-read (*)).

(*) http://lists.gnu.org/archive/html/emacs-pretest-bug/2003-02/msg00087.html

 emacs/notmuch-mua.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 00cd980..481abd7 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -287,6 +287,19 @@ the From: header is already filled in by notmuch."
 
 (defvar notmuch-mua-sender-history nil)
 
+;; Workaround: Running `ido-completing-read' in emacs 23.1, 23.2 and 23.3
+;; without some explicit initialization fill freeze the operation.
+;; Hence, we advice `ido-completing-read' to ensure required initialization
+;; is done.
+(if (and (= emacs-major-version 23) (< emacs-minor-version 4))
+    (defadvice ido-completing-read (before notmuch-ido-mode-init activate)
+      (ido-init-completion-maps)
+      (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
+      (add-hook 'choose-completion-string-functions
+		'ido-choose-completion-string)
+      (ad-disable-advice 'ido-completing-read 'before 'notmuch-ido-mode-init)
+      (ad-activate 'ido-completing-read)))
+
 (defun notmuch-mua-prompt-for-sender ()
   (interactive)
   (let (name addresses one-name-only)
-- 
1.8.0



More information about the notmuch mailing list