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-input) > "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". 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... (*) 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?!) > > Thanks in advance for any clarification, > ciao, lele. Tomi > -- > nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri > real: Emanuele Gaifas | comincerò 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