From: Tomi Ollila Date: Sun, 26 Jan 2014 11:09:45 +0000 (+0200) Subject: Re: [PATCH] emacs: initialize ido mode in notmuch-mua.el X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c6f7ab62829c5d00c47ffd56c0c0262521db4254;p=notmuch-archives.git Re: [PATCH] emacs: initialize ido mode in notmuch-mua.el --- diff --git a/4a/16a8e07811c8a43ecd21dd6c12002e81169e25 b/4a/16a8e07811c8a43ecd21dd6c12002e81169e25 new file mode 100644 index 000000000..3b6fe577d --- /dev/null +++ b/4a/16a8e07811c8a43ecd21dd6c12002e81169e25 @@ -0,0 +1,116 @@ +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 2193D431FBD + for ; Sun, 26 Jan 2014 03:10:00 -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 6m96vEAEJfOj for ; + Sun, 26 Jan 2014 03:09:52 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id A7CA8431FBC + for ; Sun, 26 Jan 2014 03:09:52 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 0BDD5100051; + Sun, 26 Jan 2014 13:09:46 +0200 (EET) +From: Tomi Ollila +To: David Bremner , + Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: initialize ido mode in notmuch-mua.el +In-Reply-To: <87y523mtd1.fsf@zancas.localnet> +References: <87y5sipcjn.fsf@qmul.ac.uk> + <1329900529-16295-1-git-send-email-markwalters1009@gmail.com> + <87bnyzoqq9.fsf@zancas.localnet> + + <87y523mtd1.fsf@zancas.localnet> +User-Agent: Notmuch/0.17+41~g8e7fabf (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Sun, 26 Jan 2014 11:10:00 -0000 + +On Sun, Jan 26 2014, David Bremner wrote: + +> Tomi Ollila writes: +> +>> +>> How about doing it with defadvice with something like: +>> +>> (from http://comments.gmane.org/gmane.emacs.bugs/27856 one can notice +>> this happening with emacs 23.3 -- David can check whether 23.4 if +>> affected) +> +> It's fixed in 23.4 +> +>> +>> (if (and (= emacs-major-version 23) (< emacs-minor-version 4)) +>> (defadvice ido-completing-read (before notmuch-ido-mode-init activate) +>> (unless (ido-mode) (ido-mode t)) +>> (ad-disable-advice 'ido-completing-read 'before 'notmuch-ido-mode-init))) +> +> Advice always seems over complex to me, but maybe I'm just +> prejudiced/ignorant. + +With defadvice we can keep "mainline code less messy and less hard to +maintain" ;) -- and only install the advice on versions that need it. + +Also with defadvice the other use of ido-completing-read is covered. + +> Can you decode/reverse-engineer the fix in +> +> http://permalink.gmane.org/gmane.emacs.bugs/41957 +> +> ? +> +> Maybe the advice or whatever should call +> +> (ido-init-completion-maps) +> (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) +> (add-hook 'choose-completion-string-functions +> 'ido-choose-completion-string)) +> +> Although that looks worryingly permanent. + +(emacs-version) -> 24.3.1 + +(describe-variable 'minibuffer-setup-hook) + +-> (rfn-eshadow-setup-minibuffer minibuffer-history-isearch-setup minibuffer-history-initialize) + +(ido-completing-read "test" '("foo" "bar")) + + +(describe-variable 'minibuffer-setup-hook) + +-> (ido-minibuffer-setup rfn-eshadow-setup-minibuffer minibuffer-history-isearch-setup minibuffer-history-initialize) + +SO, although permanent, consistent w/ newer emacs versions... + +> d + + +Tomi