From: Tomi Ollila Date: Mon, 27 Jan 2014 20:23:37 +0000 (+0200) Subject: [PATCH 1/1] emacs: initialize ido(-completing-read) in emacs 23.[123] X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d4637c4ee2d75cab40ebf66a54649f0d5f3cf814;p=notmuch-archives.git [PATCH 1/1] emacs: initialize ido(-completing-read) in emacs 23.[123] --- diff --git a/25/2e0b4c4361413679cb43f61531ffda61b15b07 b/25/2e0b4c4361413679cb43f61531ffda61b15b07 new file mode 100644 index 000000000..2cdd0ad34 --- /dev/null +++ b/25/2e0b4c4361413679cb43f61531ffda61b15b07 @@ -0,0 +1,84 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AA228431FBF + for ; Mon, 27 Jan 2014 12:23:54 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id tb-fHVb1MIYk for ; + Mon, 27 Jan 2014 12:23:45 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 6B297431FBC + for ; Mon, 27 Jan 2014 12:23:45 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 2785310008B; Mon, 27 Jan 2014 22:23:39 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 1/1] emacs: initialize ido(-completing-read) in emacs 23.[123] +Date: Mon, 27 Jan 2014 22:23:37 +0200 +Message-Id: <1390854217-7281-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: +References: +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 27 Jan 2014 20:23:54 -0000 + +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 +