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

A call to counsel-locate errors out when first character in search is a minus sign #3033

Open
nordlow opened this issue Jan 26, 2024 · 1 comment

Comments

@nordlow
Copy link

nordlow commented Jan 26, 2024

Solution: If first character is a minus sign it needs to be prefixed with a backslash.

@basil-conto
Copy link
Collaborator

(By now) I'm not sure how much counsel-locate can do about this by default.

We could change the default way of formatting the command line from locate -i --regex %s to locate -i --regex -- %s, but I don't know how portable this is.

Without more insight into that, my best suggestion is to set the user option counsel-locate-cmd to a custom function such as:

(defun my-counsel-locate-cmd (input)
  "Return a `locate' command to search for an INPUT string."
  (list locate-command "-i" "--regex" "--" input))

Of course I find it quite unfortunate that counsel-locate did not integrate from the beginning with user options like locate-make-command-line which have been with us since Emacs 20.

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

No branches or pull requests

2 participants