]> code.delx.au - gnu-emacs-elpa/commitdiff
Add `counsel-locate-cmd-mdfind`
authorAndré Peric Tavares <andre.peric.tavares@gmail.com>
Sun, 21 Feb 2016 17:09:54 +0000 (14:09 -0300)
committerAndré Peric Tavares <andre.peric.tavares@gmail.com>
Sun, 21 Feb 2016 17:09:54 +0000 (14:09 -0300)
OS X users might want to use `mdfind` instead of `locate`. The added function `counsel-locate-cmd-mdfind` can be used to accomplish that.

counsel.el

index 266746d6d6af2f6efde3dadda9d322caeaf67d74..4b229deb9eb35f2ecf65f9559e4017c6dc461179 100644 (file)
@@ -1062,7 +1062,8 @@ 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)))
+          (const :tag "No regex" counsel-locate-cmd-noregex)
+          (const :tag "mdfind" counsel-locate-cmd-mdfind)))
 
 (ivy-set-actions
  'counsel-locate
@@ -1098,6 +1099,10 @@ string - the full shell command to run."
 (defun counsel-locate-cmd-noregex (input)
   "Return a shell command based on INPUT."
   (format "locate -i '%s'" input))
+  
+(defun counsel-locate-cmd-mdfind (input)
+  "Return a shell command based on INPUT."
+  (format "mdfind -name '%s'" input))
 
 (defun counsel-locate-function (input)
   (if (< (length input) 3)