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
Feature request: Make counsel-locate command configurable #385
Comments
I like the suggestion. But I don't have OSX or Windows, so I'll have to trust the contributor's code in those areas. Feel free to open a PR. I suggest to deprecate
|
Cool, I'll open a PR. |
How should I use The issue is that Here's what I have: (defun counsel--autodetect-locate-command ()
"Try to set an appropriate command for `counsel-locate'
depending on the operating system."
(cond
((eq system-type 'darwin)
"mdfind -name")
;; TODO: find a Windows user that
;; can test Ivy and the Everything engine
;; ((eq system-type 'windows-nt)
;; "es")
(t "locate -i --regex")))
(defcustom counsel-locate-command (counsel--autodetect-locate-command)
"Format string to use in `cousel-locate-function'.
The default value is determined by `counsel--autodetect-locate-command'."
:type 'stringp
:group 'ivy) This is the problematic part: (defun counsel-locate-function (str)
(if (< (length str) 3)
(counsel-more-chars 3)
(counsel--async-command
;; (format "locate %s '%s'"
(format "%s %s '%s'"
counsel-locate-command
;; (mapconcat #'identity counsel-locate-options " ")
""
(counsel-unquote-regex-parens
(ivy--regex str))))
'("" "working..."))) Note that I commented the line that would add the parameters. Here's (defcustom counsel-locate-options (if (eq system-type 'darwin)
'("-i")
'("-i" "--regex"))
"Command line options for `locate`."
:group 'ivy
:type '(repeat string)) Should I just remove the What do you suggest? |
Just remove all uses of |
Right, I'll do that. Should it use |
I think other users are used to |
Those are the killer advantages of
I found
Searching the same string with I actually stopped using I could go on and show more examples but it would be great if some OS X users say what they think about this proposal here. |
Emacs allows |
@abo-abo OK, I'll set I don't understand why (counsel-unquote-regex-parens
(ivy--regex str)) is used in the locate function. Can't it just use the string that the user entered? Note: |
I think the issue there was that |
Some old versions of So for those cases (or if the user wants to change the default command to one without |
Please have a look. If you wish, you can add a |
Thanks. I created a |
If you wish, open a PR to add it, so that it's easier for people on OSX to customize. |
Ah, sure. I'll do it soon. |
I do know how to change it, but my vote is that |
Currently
locate
is hardcoded, so it's not possible to change the command thatcounsel-locate
uses.This is inconvenient for OS X and Windows users, as the former might want to use
mdfind
, and the lattereverything
.Reasons to use
mdfind
:locate
won't work unless the user manually starts the database.mdfind
works out of the box.I propose two things:
mdfind
everything
, of course he will want to use it (otherwisecounsel-locate
is useless for him); if I'm a OS X user,mdfind
is much better and works out of the box.If you agree with my second suggestion, I recommend using the
-name
parameter onmdfind
- it searches only on filenames (and not content), which makes the search much faster.The text was updated successfully, but these errors were encountered: