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

counsel-find-file should hide lock files as those can't be opened anyway #2117

zzantares opened this issue Jul 3, 2019 · 2 comments


Copy link

Hello, suppose that after having edited a file FileA we change to another file without having saved the previous file, Emacs creates a lock-file that use the same name of the file but are prepended with (e.g. .#FileA), when using any of counsel-find-file, counsel-projectile-find-file or counsel-git and we look for the previously edited file (by typing file), counsel brings the lock file as a suggestion, and more annoyingly, it puts it first in the list rather than the original file.

I see this as a problem, as when working at a fast pace is not hard to sometimes filter the list and press RET to choose the selection only to find out that due to speed one mistakenly tried to open a lock file and receive the message: Symbolic link that points to nonexistent file.

My first attempt to alleviate the annoyance was to change the location were lock-files are placed by Emacs, but this can't be done as this functionality is not implemented (and probably will not be, due to the nature of lock-files that must be placed along the original file). Then I just want to ask:

  • a) Is there a way to filter the suggestion list so that the lock file is hidden and not shown at all as a posible candidate file to be opened?
  • b) Is there a way to sort the suggestion list so that the lock file is always after the original file?

If not, can any of this be implemented?

Thank you.

PS. Please forgive a posible exaggerated wording regarding this issue, I just went through a marathon of game of thrones and can't seem to change my way to speak 🤔 .

@abo-abo abo-abo closed this as completed in cfb8d49 Jul 3, 2019
Copy link

abo-abo commented Jul 3, 2019

Thanks for the question. Your issue can be handled with the existing counsel-find-file-ignore-regexp.

I have added a pre-configured setting for dotfiles and lockfiles. You can use counsel-set-variable to quickly select a pre-configured setting, or set up your own ignore regexp.

Copy link

Thanks! It worked flawlessly.

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

No branches or pull requests

2 participants