From: Tomi Ollila Date: Sun, 14 Dec 2014 17:27:08 +0000 (+0200) Subject: Re: Address completion in Emacs X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3d25dfe5ffdf70c2096d09825c7faa8ab9260bb3;p=notmuch-archives.git Re: Address completion in Emacs --- diff --git a/ac/449c2a76ece9d56cb570ea463d1319e00a27b5 b/ac/449c2a76ece9d56cb570ea463d1319e00a27b5 new file mode 100644 index 000000000..ce2ccebf9 --- /dev/null +++ b/ac/449c2a76ece9d56cb570ea463d1319e00a27b5 @@ -0,0 +1,141 @@ +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 A6630431FB6 + for ; Sun, 14 Dec 2014 09:27:41 -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 2IOBovwdyWoF for ; + Sun, 14 Dec 2014 09:27:38 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 2AE8F431FAF + for ; Sun, 14 Dec 2014 09:27:38 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id D39D8100033; + Sun, 14 Dec 2014 19:27:08 +0200 (EET) +From: Tomi Ollila +To: Lele Gaifax , notmuch@notmuchmail.org +Subject: Re: Address completion in Emacs +In-Reply-To: <87d27p9t0f.fsf@nautilus.nautilus> +References: <87d27p9t0f.fsf@nautilus.nautilus> +User-Agent: Notmuch/0.19+6~g8725b09 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +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, 14 Dec 2014 17:27:41 -0000 + +On Fri, Dec 12 2014, Lele Gaifax wrote: + +> Hi all, +> +> Yesterday I tweaked my Emacs configuration to use "ido-completing-read" +> to select the right address in the minibuffer, and noticed what seems a +> glitch in the related code. +> +> To accomplish the goal, I implemented my own selection function +> +> (defun esk-notmuch-address-selection-function (prompt addresses first) +> "Use `ido-completing-read' to select one of the addresses." +> (ido-completing-read prompt (cons first addresses) +> nil nil nil 'notmuch-address-history)) +> +> and then assigned it to `notmuch-address-selection-function': +> +> (setq notmuch-address-selection-function 'esk-notmuch-address-selection= +-function) +> +> As you can see, I had to `cons' the two arguments, because the caller of +> that function does something similar to the following (where `orig' is +> the text entered before TAB-completion): +> +> (options (notmuch-address-options orig)) +> (num-options (length options)) +> (chosen (funcall notmuch-address-selection-function +> (format "Address (%s matches): " num-options) +> (cdr options) (car options))) +> +> and the standard `notmuch-address-selection-function' is defined like: +> +> (defun notmuch-address-selection-function (prompt collection initial-in= +put) +> "Call (`completing-read' +> PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)" +> (completing-read +> prompt collection nil nil initial-input 'notmuch-address-history)) +> +> where that `initial-input' is not what I initially thought, the text +> entered by the user, but rather the first completion candidate. +> +> Wouldn't it be more "correct" to pass the unchanged `options' list and +> the "real" `orig' text as `initial-input' to the customizable function +> instead? + +I think I am to be blamed why that is like this -- initially there were +no notmuch-address-selection-function ... I added as I needed it, in + +Stashed: id:1365001734-3160-1-git-send-email-tomi.ollila@iki.fi +Stashed: http://mid.gmane.org/1365001734-3160-1-git-send-email-tomi.ollila@= +iki.fi + +and I was not smart enough to do the splitting in "standard +notmuch-address-selection-function".=20=20 + +Later, someone(*) provided patch which would make the "standard" interface +work better with ido-completing-read -- unfortunately that made the +default, original interface which uses completing-read borken. + +Personally I'd like to see leaner interface there, but that is incompatible +change and in this particular case I don't see compelling reason to do that= +...=20 + +(*) cannot remember who and when, and I am writing this mail on a Mac and +the use is painful enough now (keybindings, focus behaviour, etc...);/ + +> +> I understand that it may be undesiderable to break existing +> configurations by rectifying the arguments in that way, and in such case +> could we change the `initial-input' argument name to better reflect the +> fact that it actually contains one possible candidate instead? + +Naming change would indeed be a good idea... (probably?!)=20=20 + +> +> Thanks in advance for any clarification, +> ciao, lele. + +Tomi + +> --=20 +> nickname: Lele Gaifax | Quando vivr=C3=B2 di quello che ho pensato ieri +> real: Emanuele Gaifas | comincer=C3=B2 ad aver paura di chi mi copia. +> lele@metapensiero.it | -- Fortunato Depero, 1929. +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch