summaryrefslogtreecommitdiff
path: root/helm-locate.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-01-07 08:12:41 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-01-07 08:12:41 +0100
commit4476aa096b4468e9e951e66d9be94d5e19faeea7 (patch)
tree0ad89abe89a835f111eb0af9b9c7b1b6c6ba60c7 /helm-locate.el
parent30ad95ccb86fd62565d103659e693d562beb5bc9 (diff)
Fix some regexp issues when switching back and forth from locate to hff.
* helm-locate.el (helm-locate-with-db): Ensure -b is not already set by previous embeded session. (helm-locate-pattern-transformer): Ensure -b is the last "-b".
Diffstat (limited to 'helm-locate.el')
-rw-r--r--helm-locate.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/helm-locate.el b/helm-locate.el
index 07deb488..55183e93 100644
--- a/helm-locate.el
+++ b/helm-locate.el
@@ -246,8 +246,9 @@ See also `helm-locate'."
collect i) ":"))
helm-locate-command)
(if helm-locate-fuzzy-match
- (replace-regexp-in-string
- "locate" "locate -b" helm-locate-command)
+ (unless (string-match-p "\\`locate -b" helm-locate-command)
+ (replace-regexp-in-string
+ "\\`locate" "locate -b" helm-locate-command))
helm-locate-command))))
(setq helm-file-name-history (mapcar 'helm-basename file-name-history))
(helm :sources 'helm-source-locate
@@ -336,16 +337,17 @@ See also `helm-locate'."
(helm-basename candidate)
candidate))))
+;; TODO Handle other options added at end of pattern (e.g -l 12) .
(defun helm-locate-pattern-transformer (pattern)
(if helm-locate-fuzzy-match
;; When fuzzy is enabled helm add "-b" option on startup.
(cond ((string-match-p
- " " (replace-regexp-in-string " -b" "" pattern))
+ " " (replace-regexp-in-string " -b\\'" "" pattern))
(when (string-match "\\`locate -b" helm-locate-command)
(setq helm-locate-command
(replace-match "locate" t t helm-locate-command)))
pattern)
- ((string-match "\\([^ ]*\\) -b" pattern)
+ ((string-match "\\([^ ]*\\) -b\\'" pattern)
(helm--mapconcat-pattern (match-string 1 pattern)))
(t
(unless (string-match-p "\\`locate -b" helm-locate-command)