[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a50f668 111/272: counsel.el (counsel-locate-options): Make
From: |
Oleh Krehel |
Subject: |
[elpa] master a50f668 111/272: counsel.el (counsel-locate-options): Make obsolete |
Date: |
Mon, 25 Apr 2016 10:13:20 +0000 |
branch: master
commit a50f668af9a70049c54b6c85683f375d64dfb3bb
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-locate-options): Make obsolete
* counsel.el (counsel-locate-cmd): New defcustom that replaces
`counsel-locate-options'.
(counsel-locate-cmd-default): New defun. Corresponds to the default
value of `counsel-locate-options' on linux.
(counsel-locate-cmd-noregex): New defun. Corresponds to the default
value of `counsel-locate-options' on darwin.
(counsel-locate-function): Use `counsel-locate-cmd'.
Fixes #385
---
counsel.el | 63 +++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 41 insertions(+), 22 deletions(-)
diff --git a/counsel.el b/counsel.el
index d3897d7..83eca7a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -978,6 +978,33 @@ Update the minibuffer with the amount of lines collected
every
(delete-process process))))
;;* `counsel-locate'
+(defcustom counsel-locate-options nil
+ "Command line options for `locate`."
+ :group 'ivy
+ :type '(repeat string))
+
+(make-obsolete-variable 'counsel-locate-options 'counsel-locate-cmd "0.7.0")
+
+(defcustom counsel-locate-cmd (if (eq system-type 'darwin)
+ 'counsel-locate-cmd-noregex
+ 'counsel-locate-cmd-default)
+ "The function for producing a locate command string from the input.
+
+The function takes a string - the current input, and returns a
+string - the full shell command to run."
+ :group 'ivy
+ :type '(choice
+ (const :tag "Default" counsel-locate-cmd-default)
+ (const :tag "No regex" counsel-locate-cmd-noregex)))
+
+(ivy-set-actions
+ 'counsel-locate
+ '(("x" counsel-locate-action-extern "xdg-open")
+ ("d" counsel-locate-action-dired "dired")))
+
+(defvar counsel-locate-history nil
+ "History for `counsel-locate'.")
+
(defun counsel-locate-action-extern (x)
"Use xdg-open shell command on X."
(call-process shell-file-name nil
@@ -985,39 +1012,31 @@ Update the minibuffer with the amount of lines collected
every
shell-command-switch
(format "%s %s"
(if (eq system-type 'darwin)
- "open"
- "xdg-open")
+ "open"
+ "xdg-open")
(shell-quote-argument x))))
(declare-function dired-jump "dired-x")
+
(defun counsel-locate-action-dired (x)
"Use `dired-jump' on X."
(dired-jump nil x))
-(defvar counsel-locate-history nil
- "History for `counsel-locate'.")
-
-(defcustom counsel-locate-options (if (eq system-type 'darwin)
- '("-i")
- '("-i" "--regex"))
- "Command line options for `locate`."
- :group 'ivy
- :type '(repeat string))
-
-(ivy-set-actions
- 'counsel-locate
- '(("x" counsel-locate-action-extern "xdg-open")
- ("d" counsel-locate-action-dired "dired")))
+(defun counsel-locate-cmd-default (input)
+ "Return a shell command based on INPUT."
+ (format "locate -i --regex '%s'"
+ (counsel-unquote-regex-parens
+ (ivy--regex input))))
+(defun counsel-locate-cmd-noregex (input)
+ "Return a shell command based on INPUT."
+ (format "locate -i '%s'" input))
-(defun counsel-locate-function (str)
- (if (< (length str) 3)
+(defun counsel-locate-function (input)
+ (if (< (length input) 3)
(counsel-more-chars 3)
(counsel--async-command
- (format "locate %s '%s'"
- (mapconcat #'identity counsel-locate-options " ")
- (counsel-unquote-regex-parens
- (ivy--regex str))))
+ (funcall counsel-locate-cmd input))
'("" "working...")))
;;;###autoload
- [elpa] master 6a5a688 201/272: counsel.el: Improve counsel-grep, (continued)
- [elpa] master 6a5a688 201/272: counsel.el: Improve counsel-grep, Oleh Krehel, 2016/04/25
- [elpa] master 65cf724 247/272: Make ivy--regex work with "[^ ]", Oleh Krehel, 2016/04/25
- [elpa] master f72cea2 253/272: swiper.el (swiper-mc): Restore interactive, Oleh Krehel, 2016/04/25
- [elpa] master 08d5578 137/272: counsel.el (counsel-git-log): New command, Oleh Krehel, 2016/04/25
- [elpa] master 00f08f7 073/272: Improve Ivy documentation UI, Oleh Krehel, 2016/04/25
- [elpa] master 8f527d7 149/272: ivy.el (ivy-next-history-element): No "\\_<" for dynamic-collection, Oleh Krehel, 2016/04/25
- [elpa] master 265bf49 251/272: counsel.el: Fix compile warning, Oleh Krehel, 2016/04/25
- [elpa] master 7cf13a7 186/272: counsel.el (counsel-linux-app): New command, Oleh Krehel, 2016/04/25
- [elpa] master 31a2f86 238/272: counsel.el (counsel-expression-history): enable-recursive-minibuffers, Oleh Krehel, 2016/04/25
- [elpa] master 5299c0a 099/272: doc/ivy.texi: Re-export from previous commit, Oleh Krehel, 2016/04/25
- [elpa] master a50f668 111/272: counsel.el (counsel-locate-options): Make obsolete,
Oleh Krehel <=
- [elpa] master 327b85a 239/272: counsel.el (counsel-expression-history): Add docstring, Oleh Krehel, 2016/04/25
- [elpa] master b6f3e45 271/272: Rename swiper -> ivy, Oleh Krehel, 2016/04/25
- [elpa] master 9aa1f5c 156/272: counsel.el (counsel-mode-map): Add counsel-M-x, Oleh Krehel, 2016/04/25
- [elpa] master 6757030 225/272: counsel-grep now works with ivy-occur-revert-buffer, Oleh Krehel, 2016/04/25
- [elpa] master 6026caf 174/272: counsel.el (counsel-locate-cmd-es): Add, Oleh Krehel, 2016/04/25
- [elpa] master 7ed5b06 119/272: ivy.el (ivy--preselect-index): Don't use regexp-quote, Oleh Krehel, 2016/04/25
- [elpa] master dcf4957 123/272: counsel.el (counsel--async-command): Add sentinel and filter args, Oleh Krehel, 2016/04/25
- [elpa] master 53ca6ed 065/272: ivy.el (ivy-do-completion-in-region): New defcustom, Oleh Krehel, 2016/04/25
- [elpa] master ca2b47f 240/272: Add timing information to async commands, Oleh Krehel, 2016/04/25
- [elpa] master d544427 093/272: swiper.el (swiper--re-builder): Replace \t with 4 spaces, Oleh Krehel, 2016/04/25