[PATCH] Switch to DEF from INITIAL-INPUT in completing-read.

Tomi Ollila tomi.ollila at iki.fi
Wed Aug 21 12:19:11 PDT 2013


On Wed, Aug 21 2013, Christopher Wellons <wellons at nullprogram.com> wrote:

> As stated in the Emacs documentation, the initial-input argument is
> deprecated because it presents a poor interface to the user. In fact,
> with my setup where ido replaces completing-read, it's nearly unusable
> with initial-input.
>
> http://www.gnu.org/software/emacs/manual/html_node/elisp/Initial-Input.html
> ---

I agree that this behaves better, but the empty content with completing-read
looks a bit confusing (if arrow keys or tab aren't pressed)

Although the completing-read documentation also deprecates (STRING . POSITION)
format IMO I found that to work best there: i.e.

-   prompt collection nil nil initial-input 'notmuch-address-history))
+   prompt collection nil nil (cons initial-input 0) 'notmuch-address-history))


I don't know how ido-replaced completing-read (just ido-completing-read ?)
works there, though.

Better get other thoughts/opinions too -- I use this:

https://github.com/domo141/nottoomuch/blob/dogfood/selection-menu.rst

for choosing completions -- it ignores INITIAL-INPUT (/DEF) argument
altogether. 



Tomi


>  emacs/notmuch-address.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index fa65cd5..e89200b 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -42,11 +42,11 @@ to know how address selection is made by default."
>    :group 'notmuch-send
>    :group 'notmuch-external)
>  
> -(defun notmuch-address-selection-function (prompt collection initial-input)
> +(defun notmuch-address-selection-function (prompt collection def)
>    "Call (`completing-read'
> -      PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
> +      PROMPT COLLECTION nil nil nil 'notmuch-address-history DEF)"
>    (completing-read
> -   prompt collection nil nil initial-input 'notmuch-address-history))
> +   prompt collection nil nil nil 'notmuch-address-history def))
>  
>  (defvar notmuch-address-message-alist-member
>    '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
> -- 
> 1.8.4.rc3
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list