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?
Would I then have to press TAB twice to get the first result? > 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? >From the perspective of `notmuch-address-selection-function', it _is_ the `initial-input', as that is what is presented to the user. > Thanks in advance for any clarification, > ciao, lele. > -- > nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri > real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia. > lele at metapensiero.it | -- Fortunato Depero, 1929. > > _______________________________________________ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch