From aa8f705d090f62621efa61c7cbc49d91e45cddde Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Tue, 10 Jan 2017 11:52:14 +0100 Subject: Fuzzy match on basename in locate. * helm-locate.el (helm-locate-fuzzy-sort-fn): Use helm-locate-default-fuzzy-sort-fn. (helm-locate-default-fuzzy-sort-fn): New. * helm.el (helm-fuzzy-matching-default-sort-fn-1): Takes one more arg basename. --- helm-locate.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'helm-locate.el') diff --git a/helm-locate.el b/helm-locate.el index f3c58ccd..135a9217 100644 --- a/helm-locate.el +++ b/helm-locate.el @@ -96,7 +96,7 @@ Note that when this is enabled searching is done on basename." :type 'boolean) (defcustom helm-locate-fuzzy-sort-fn - #'helm-fuzzy-matching-default-sort-fn-1 + #'helm-locate-default-fuzzy-sort-fn "Default fuzzy matching sort function for locate." :group 'helm-locate :type 'boolean) @@ -325,6 +325,11 @@ See also `helm-locate'." (helm-log "Error: Locate %s" (replace-regexp-in-string "\n" "" event)))))))))) +(defun helm-locate-default-fuzzy-sort-fn (candidates) + "Default sort function for files in fuzzy matching. +Sort is done on basename of CANDIDATES." + (helm-fuzzy-matching-default-sort-fn-1 candidates nil t)) + (defclass helm-locate-source (helm-source-async helm-type-file) ((init :initform 'helm-locate-set-command) (candidates-process :initform 'helm-locate-init) -- cgit v1.2.3