unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: Re: widgets with dynamic-choice
Date: Tue, 19 Jul 2016 10:11:58 -0400	[thread overview]
Message-ID: <87shv5ra35.fsf@lifelogs.com> (raw)
In-Reply-To: jwveg6phjrw.fsf-monnier+gmane.emacs.devel@gnu.org

On Tue, 19 Jul 2016 09:24:15 -0400 Stefan Monnier <monnier@iro.umontreal.ca> wrote: 

>>>> * when should the widget get updated?
SM> [ BTW, "updated" doesn't seem like the right word.  Did you mean
SM>   "computed"?  ]

Yes, thank you.

SM> When we need to display it?
>> That means potentially a long delay on display. With customization UIs
>> that can be really frustrating. Can we agree on a timeout at least?

SM> We don't have such a thing for the completion table of text-based
SM> widgets, so I don't see why we should have that here.  IOW I think it's
SM> the responsability of the function not to take too much time.

I think that's easy for the programmers but annoying for the users.
Responsive UI is important everywhere in Emacs. I am happy to discuss
the pros and cons of what I'm proposing, I'm not saying it must be done.
Only that it should not be discarded outright.

Specifically for this case, interactive dialogs should show something
within 1-5 seconds or users will assume something is wrong and try to
interrupt or move away. The research below is on website responsiveness,
but IMO also applies to us:

https://www.nngroup.com/articles/website-response-times/

>>>> * how are errors handled? do we empty the list or go back to the last
>>>> good version?
SM> I wouldn't try to be clever here either.  Just let the signal percolate.
>> So presumably a novice user will get a strange error that they don't
>> know how to handle or report? It's a practical solution but maybe a bit
>> unfriendly...

SM> In case there's a bug in the function?  Yes.  Same as when there's a bug
SM> anywhere else.  I don't understand why you think this case is different.

Because currently widgets load instantly from a fixed set (with the one
exception you mentioned), and with this proposal they can call a
function. We're adding complexity so I wanted to at least consider the
effect of it to users in the Customize interface.

>> (defcustom myvar nil "Whatever" :type '(choice :dynamic myvar-dynamic-choice-function))

SM> Yes, it would be great to allow this kind of :dynamic for
SM> various types.  But I'm not familiar enough with the code to have
SM> a sense of how it would work out.

All right, if we agree on the handling of errors and timeouts (none for
now), and on the defcustom syntax above, here's my implementation proposal:

I think `widget-setup' is the right place to add the dynamic fills
(computation), hooking that into the buffer redisplay hook. The part of
`widget-*-value-create' that gets and inserts the list of choices from
:args will need to be factored out so it can be called from
that hook. WDYT?

Ted




  reply	other threads:[~2016-07-19 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 16:53 widgets with dynamic-choice Ted Zlatanov
2016-07-18 17:26 ` Stefan Monnier
2016-07-18 18:25   ` Ted Zlatanov
2016-07-19 13:24     ` Stefan Monnier
2016-07-19 14:11       ` Ted Zlatanov [this message]
2016-07-19 14:25         ` Stefan Monnier
2016-07-26 14:42           ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shv5ra35.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).