Skip to content
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

completing-read-multi can't select all, resets after each selection #395

Open
WorldsEndless opened this issue Jan 23, 2021 · 9 comments
Open

Comments

@WorldsEndless
Copy link

I used to use helm, and then ivy, to select addresses for emails I'm composing. I've now written it up using completing-read-multiple and at first it appears to work fine; indeed, there's no problem if I select only one. But I have problems with other major work flows:

  1. Search for all addresses that are part of my "newsletter" group (works fine; I see all those addresses)

2a. Fails: Try to select all of them at once (I can't find a "select all" key in standard completing-read-multiple; does it exist?)

2b. Press "TAB" to add one individually

  1. After adding that one option, I'm back to step 1: I need search again, re-enter "newsletter" etc.

How can I select all? Similarly, it seems like an undesirable workflow that hitting TAB always resets your Selectrum results.

@clemera
Copy link
Collaborator

clemera commented Jan 24, 2021

A select all funcitonality doesn't exist, I think adding it to our adapted version in Selectrum is a great idea.

Similarly, it seems like an undesirable workflow that hitting TAB always resets your Selectrum results

Hitting TAB adds another candidate to your results and you can proceed searching for more. Do you think we could do better? What behaviour are you looking for? Maybe the prompt should be selected after TAB so one can immediately exit with RET or proceed searching by typing.

@WorldsEndless
Copy link
Author

Hitting TAB adds another candidate to your results and you can proceed searching for more. Do you think we could do better? What behaviour are you looking for? Maybe the prompt should be selected after TAB so one can immediately exit with RET or proceed searching by typing.

My work flow is this:

  1. Start my completing-read-multiple
  2. type "newsletter", which reduces it appropriately
  3. Since there's no "select all", I choose one and press "tab"
  4. My prompt now includes the one I chose, followed by crm-separator
  5. I have to re-specify "newsletter" to find out who to add next

My snippet:

      (let ((crm-separator "|"))
	(insert (string-join
		 (mapcar 'tsa/format-insert-email
			 (completing-read-multiple "Select:" (tsa/get-address-names (bbdb-records))))
		 ", "))) 

@WorldsEndless WorldsEndless changed the title consulting-read-multi can't select all, resets after each selection completing-read-multi can't select all, resets after each selection Jan 24, 2021
@clemera
Copy link
Collaborator

clemera commented Jan 24, 2021

Thanks, as far as I understand we would only need to provide a select all functionality to make this use case more convenient. The reset is intentional and for the usual case it makes sense to keep it that way unless I am missing something. Keeping the prompt selected as I mentioned earlier might still be nice.

@clemera
Copy link
Collaborator

clemera commented Jan 24, 2021

After trying I also see now that if you want to select multiple candidates which share a common substring the reset is inconvenient. Maybe we could have a key to add a candidate but also keep the current search string this would also solve the use case when you don't want all but multiple ones with a same substring.

@clemera
Copy link
Collaborator

clemera commented Jan 24, 2021

For reference the following improvements for crm could be nice:

  • Add a command to select all
  • Add a command to add the current candidate but also keep the input, maybe a general restrict to matches command which I remember was requested for usual completion could be used, it would help also for the crm use case here.
  • Select the prompt after inserting a candidate

@WorldsEndless
Copy link
Author

These are good. An addition that would be nice is a face to highlight elements that have already been selected, so it's easily visible.

@clemera
Copy link
Collaborator

clemera commented Jan 25, 2021

You probably did not notice that we already omit candidates which are selected.

@WorldsEndless
Copy link
Author

WorldsEndless commented Jan 25, 2021 via email

@clemera
Copy link
Collaborator

clemera commented Jan 27, 2021

Regarding the prompt selection I think it is better to stay consistent with how we handle it elsewhere (for example file completions). To finish your input you should press "RET" on the last candidate. If you "wrongly" typed "TAB" you can remove the last "," or select the prompt to submit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants