Browse files

Bugfix locate not starting when use with helm-for-files on startup.

* helm-locate.el (helm-locate-set-command): New.
(helm-locate-with-db, helm-c-source-locate): Use it.
  • Loading branch information...
1 parent d3e91be commit 3f303feff2c6ab45833052ad48b6ffae94d9a797 @thierryvolpiatto thierryvolpiatto committed Apr 2, 2012
Showing with 12 additions and 7 deletions.
  1. +12 −7 helm-locate.el
19 helm-locate.el
@@ -124,20 +124,24 @@ See `helm-locate-with-db' and `helm-locate'."
+(defun helm-locate-set-command ()
+ "Setup `helm-c-locate-command' if not already defined."
+ (unless helm-c-locate-command
+ (setq helm-c-locate-command
+ (case system-type
+ ('gnu/linux "locate -i -r %s")
+ ('berkeley-unix "locate -i %s")
+ ('windows-nt "es -i -r %s")
+ (t "locate %s")))))
(defun helm-locate-with-db (&optional db initial-input)
"Run locate -d DB.
If DB is not given or nil use locate without -d option.
Argument DB can be given as a string or list of db files.
Argument INITIAL-INPUT is a string to use as initial-input.
See also `helm-locate'."
(when (and db (stringp db)) (setq db (list db)))
- (unless helm-c-locate-command
- (setq helm-c-locate-command
- (case system-type
- ('gnu/linux "locate -i -r %s")
- ('berkeley-unix "locate -i %s")
- ('windows-nt "es -i -r %s")
- (t "locate %s"))))
+ (helm-locate-set-command)
(let ((helm-c-locate-command
(if db
@@ -176,6 +180,7 @@ See also `helm-locate'."
(defvar helm-c-source-locate
`((name . "Locate")
+ (init . helm-locate-set-command)
(candidates . helm-c-locate-init)
(type . file)
(requires-pattern . 3)

0 comments on commit 3f303fe

Please sign in to comment.