[PATCH] emacs: initialize ido mode in notmuch-mua.el

Tomi Ollila tomi.ollila at iki.fi
Sun Jan 26 03:09:45 PST 2014


On Sun, Jan 26 2014, David Bremner <david at tethera.net> wrote:

> Tomi Ollila <tomi.ollila at iki.fi> 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


More information about the notmuch mailing list