-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-obvious "Join it, or load link with browser?" prompt #241
Comments
Seems like a good idea. Thanks. |
Before I go ahead with a PR... I wonder if there's a better phrasing/letter for the second option. OTOH ( Or
I admit there's a succinct and familiar ring to the last one, despite my earlier comments, but I don't have a single firm favourite, and there might be something else which is better than those. What do you think? |
"View with browser?" "Visit with browser?" I don't know if those are necessarily better than "open", "load", or "browse", but maybe worth considering. |
Whatever the phrasing, it looks like (read-multiple-choice
"Room not joined on current session."
'((?j "join" "Join room in ement.el")
(?w "web browser" "Open URL in web browser"))) ...and because I was experimenting, a fancier (but probably unnecessary) version help-wise: (let* ((help-format "\
You are not currently joined to that room. You can either join the room
in ement.el, or visit the link URL in your web browser.\n\n%s")
(prompt-choices '((?j "join" "Join room in ement.el")
(?w "web browser" "Open URL in web browser")))
(help-choices (mapconcat (lambda (c)
(format "%c: %s\n" (car c) (caddr c)))
prompt-choices)))
(read-multiple-choice "Room not joined on current session."
prompt-choices
(format help-format help-choices))) |
Sure, I think that's fine. Maybe say "in Emacs" rather than "in ement.el"? |
Sure thing. For clarity, did you want the more basic version or the one with the fancier help? |
I'm comfortable with deferring to your judgment on that. Since I'm the original developer and you're also a user, your perspective may be more important than mine. |
@phil-s If you're still interested, I'll be glad to merge a PR for this without delay. It doesn't seem like something that needs much testing first. |
Let's leave it for 0.15. I can't do a PR immediately, and it's a minor thing. |
I quite like the verbose help, and I also think the default multi-column help formatting seems awkward in the way in which it wraps lines, so here's a wrapper which resolves those things. (defun ement-read-multiple-choice (prompt choices &optional help)
"Wrapper for `read-multiple-choice'."
(let ((help-format (if help
(concat (replace-regexp-in-string "%" "%%" help)
"\n\n%s")
"%s"))
(help-choices (mapconcat (lambda (c)
(format "%c: %s\n" (car c) (caddr c)))
choices)))
(read-multiple-choice prompt choices
(format help-format help-choices))))
(cl-case (car (ement-read-multiple-choice
"Room not joined on current session."
'((?j "join" "Join room in ement.el")
(?w "web browser" "Open URL in web browser"))
"\
You are not currently joined to that room. You can either join the room
in ement.el, or visit the link URL in your web browser."))
(?j 'join-it)
(?w 'browse-it)) |
I've just realised that the "load link with browser" I'll fix that while I'm at it... |
Thanks for your work and your patience! |
I selected a chat URL someone had posted, and ement.el prompted me with:
To which my thought was: "Uh, Yes?"
I.e. It's a
completing-read
, but the prompt comes across like a paradoxicalyes-or-yes-p
query. Guessing what was happening, I typed TAB and got the completions buffer "2 possible completions: Join room, Load link with browser".I suspect the code was written with an expectation that users are running some completion framework which automatically displays the completions, but that's not the default behaviour and I think this isn't the best way to handle such a query.
How about this:?
The text was updated successfully, but these errors were encountered: