Skip to content

Commit

Permalink
* helm-locate.el: Allow creating a locate.db with persistent action.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Volpiatto committed Jul 24, 2012
1 parent 9487f87 commit d6c876f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion helm-locate.el
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ The \"-r\" option must be the last option."
:type 'string :type 'string
:group 'helm-locate) :group 'helm-locate)


(defcustom helm-locate-create-db-command
"updatedb -l 0 -o %s -U %s"
"Command used to create a locale locate db file."
:type 'string
:group 'helm-locate)

(defvar helm-generic-files-map (defvar helm-generic-files-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(set-keymap-parent map helm-map) (set-keymap-parent map helm-map)
Expand Down Expand Up @@ -110,11 +116,22 @@ See `helm-locate-with-db' and `helm-locate'."
(and localdb (and localdb
(or (helm-ff-find-locatedb from-ff) (or (helm-ff-find-locatedb from-ff)
(helm-c-read-file-name (helm-c-read-file-name
"LocateDBFiles: " "Choose or create Locate Db file: "
:initial-input (or helm-ff-default-directory :initial-input (or helm-ff-default-directory
default-directory) default-directory)
:marked-candidates t :marked-candidates t
:preselect helm-locate-db-file-regexp :preselect helm-locate-db-file-regexp
:persistent-action #'(lambda (candidate)
(shell-command
(format helm-locate-create-db-command
candidate
helm-ff-default-directory))
(helm-force-update
(if helm-ff-transformer-show-only-basename
(helm-c-basename candidate)
candidate)))
:must-match t
:persistent-help "Create locale locate Db"
:test #'(lambda (x) :test #'(lambda (x)
(if helm-locate-db-file-regexp (if helm-locate-db-file-regexp
;; Select only locate db files and directories ;; Select only locate db files and directories
Expand Down

0 comments on commit d6c876f

Please sign in to comment.