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

Prevent intermediate selections or directories from appearing in history #212

Closed
arocks opened this issue Oct 9, 2020 · 6 comments
Closed

Comments

@arocks
Copy link

arocks commented Oct 9, 2020

When I navigate to a nested directory from root for e.g. /mnt/A/B/C/file.txt then all the intermediate candidates I have chosen also appear in my history. That is, the second time I use selectrum and keep pressing M-p, it shows me the following options:

/mnt/A/B/C/file.txt
/mnt/A/B/C/
/mnt/A/B/
/mnt/A/
/mnt/

I would prefer to have only the first item (i.e. the file I eventually opened) rather than all the selections I made while navigating to the file.

Also, is it possible to remove duplicates from history? For e.g. if I open file.txt frequently I would like to have only the most recent occurrence in history.

BTW, thank you so much for creating this excellent package. Lots of good design choices and light on resources.

@clemera
Copy link
Collaborator

clemera commented Oct 9, 2020

Thank you for pointing out that this behaviour isn't so great for file browsing. I believe I was the one who suggested this, this was before I used prescient for sorting. With prescient this is behaviour is less useful and as you pointed out it is generally a bad idea to do this for browsing files. We could disable it only for file browsing but my current opinion is that adding entries on insertion is generally unexpected and shouldn't be the default.

@clemera
Copy link
Collaborator

clemera commented Oct 9, 2020

Also, is it possible to remove duplicates from history? For e.g. if I open file.txt frequently I would like to have only the most recent occurrence in history.

You can set the variable history-delete-duplicates for this.

@arocks
Copy link
Author

arocks commented Oct 10, 2020

Thank you for sharing the background of this behavior. The history-delete-duplicates tip was exactly what I needed!

@clemera
Copy link
Collaborator

clemera commented Oct 12, 2020

Glad I could help, does the merged fix (#213) solve your issue?

@clemera clemera added the waiting on response Needs more info or follow-up, will be closed after 90 days if no response label Oct 12, 2020
@arocks
Copy link
Author

arocks commented Oct 14, 2020

Hi @clemera , yes I have been using the diff for the last few days and it does work as I had hoped. Would be happy to close this issue.

@clemera
Copy link
Collaborator

clemera commented Oct 14, 2020

Okay, thanks again for discovering this!

@clemera clemera closed this as completed Oct 14, 2020
@clemera clemera removed the waiting on response Needs more info or follow-up, will be closed after 90 days if no response label Oct 14, 2020
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