unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Switch to DEF from INITIAL-INPUT in completing-read.
@ 2013-08-21 16:44 Christopher Wellons
  2013-08-21 19:19 ` Tomi Ollila
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Wellons @ 2013-08-21 16:44 UTC (permalink / raw)
  To: notmuch; +Cc: Christopher Wellons

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
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switch to DEF from INITIAL-INPUT in completing-read.
  2013-08-21 16:44 [PATCH] Switch to DEF from INITIAL-INPUT in completing-read Christopher Wellons
@ 2013-08-21 19:19 ` Tomi Ollila
  2013-08-22 17:08   ` Tomi Ollila
  0 siblings, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2013-08-21 19:19 UTC (permalink / raw)
  To: Christopher Wellons, notmuch

On Wed, Aug 21 2013, Christopher Wellons <wellons@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switch to DEF from INITIAL-INPUT in completing-read.
  2013-08-21 19:19 ` Tomi Ollila
@ 2013-08-22 17:08   ` Tomi Ollila
  2013-08-23  2:11     ` Christopher Wellons
  0 siblings, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2013-08-22 17:08 UTC (permalink / raw)
  To: Christopher Wellons, notmuch

On Wed, Aug 21 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:

> On Wed, Aug 21 2013, Christopher Wellons <wellons@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))

Actually, I don't know this anymore. Yesterday the current worked a bit
badly but today while I was testing something else the current worked ok...

... but you're right, with ido-completing-read the current is unusable:

(load-library "ido")
(ido-completing-read "foo" '("foo" "bar" "baz") nil nil "foo")

and especially

(ido-completing-read "foo" '("foo" "bar" "baz") nil nil '("foo" . 0))

and, 

(ido-completing-read "foo" '("foo" "bar" "baz") nil nil nil nil "foo")

surely works the best of the above...

we could also drop the default/initial input:

(ido-completing-read "foo" '("foo" "bar" "baz"))
(completing-read "foo" '("foo" "bar" "baz"))

So that, with completing-read, user presses enter on empty content,
empty string is returned... and doesn't affect how ido-completing-read
does it...

>
> 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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switch to DEF from INITIAL-INPUT in completing-read.
  2013-08-22 17:08   ` Tomi Ollila
@ 2013-08-23  2:11     ` Christopher Wellons
  2013-08-24  7:18       ` Tomi Ollila
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Wellons @ 2013-08-23  2:11 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

>> 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)

You're right. Taking a look at this with completing-read I see it's not
obvious what defaulting will do.

> we could also drop the default/initial input:

The default is usually what I want to select, so I like being able to
just hit tab/enter to select it.

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

I'm using ido-ubiquitous, which installs ido-completing-read overtop
completing-read along with some compatability tweaks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switch to DEF from INITIAL-INPUT in completing-read.
  2013-08-23  2:11     ` Christopher Wellons
@ 2013-08-24  7:18       ` Tomi Ollila
  0 siblings, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2013-08-24  7:18 UTC (permalink / raw)
  To: Christopher Wellons, notmuch

On Fri, Aug 23 2013, Christopher Wellons <wellons@nullprogram.com> wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>>> 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)
>
> You're right. Taking a look at this with completing-read I see it's not
> obvious what defaulting will do.
>
>> we could also drop the default/initial input:
>
> The default is usually what I want to select, so I like being able to
> just hit tab/enter to select it.
>
>>> I don't know how ido-replaced completing-read (just ido-completing-read ?)
>>> works there, though.
>
> I'm using ido-ubiquitous, which installs ido-completing-read overtop
> completing-read along with some compatability tweaks.

The compatibility tweaks doesn't seem to be enough ;/ 

One option would be to so somehow to detect that completing-read is
actually replaced with something (anything?) else and arrange the
arguments differently. I think in this case such a feature
could be tolerated... :D


Tomi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-24  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-21 16:44 [PATCH] Switch to DEF from INITIAL-INPUT in completing-read Christopher Wellons
2013-08-21 19:19 ` Tomi Ollila
2013-08-22 17:08   ` Tomi Ollila
2013-08-23  2:11     ` Christopher Wellons
2013-08-24  7:18       ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).