Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature request: Make counsel-locate command configurable #385
Reasons to use
I propose two things:
If you agree with my second suggestion, I recommend using the
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
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.
(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
Those are the killer advantages of
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.
Some old versions of
So for those cases (or if the user wants to change the default command to one without