diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-09-22 05:26:29 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-09-22 05:26:29 +0200 |
commit | e0c2f4948a8496ad6708611a6d442256c8b3508d (patch) | |
tree | 0fb7aba4ba41ebaa028d112d04d215926d2b06be | |
parent | 0af7e22283d6b6c46b72ed6813cbf3511a474b71 (diff) |
Fix migemo for buffers over others filters (#1175).
* helm-buffers.el (helm-source-buffers): Use nomultimatch
symbol for migemo.
(helm-buffer--match-pattern): Fix for migemo.
* helm-source.el (helm-source-sync): Fix docstring.
(helm-source-in-buffer): Fix docstring.
(helm--setup-source): Use nomultimatch symbol in sync and in-buffer.
-rw-r--r-- | helm-buffers.el | 15 | ||||
-rw-r--r-- | helm-source.el | 36 |
2 files changed, 33 insertions, 18 deletions
diff --git a/helm-buffers.el b/helm-buffers.el index 06138d4c..63c7c3aa 100644 --- a/helm-buffers.el +++ b/helm-buffers.el @@ -212,7 +212,7 @@ Only buffer names are fuzzy matched when this is enabled, (with-helm-buffer (helm-force-update)))))) (keymap :initform helm-buffer-map) - (migemo :initform t) + (migemo :initform 'nomultimatch) (volatile :initform t) (help-message :initform 'helm-buffer-help-message) (persistent-help @@ -475,14 +475,17 @@ i.e same color." (and neg neg-test (not neg-test))))))) (defun helm-buffer--match-pattern (pattern candidate) - (let ((fun (if (and helm-buffers-fuzzy-matching + (let ((bfn (if (and helm-buffers-fuzzy-matching + (not helm-migemo-mode) (not (string-match "\\`\\^" pattern))) #'helm--mapconcat-pattern - #'identity))) + #'identity)) + (mfn (if helm-migemo-mode + #'helm-mm-migemo-string-match #'string-match))) (if (string-match "\\`!" pattern) - (not (string-match (funcall fun (substring pattern 1)) - candidate)) - (string-match (funcall fun pattern) candidate)))) + (not (funcall mfn (funcall bfn (substring pattern 1)) + candidate)) + (funcall mfn (funcall bfn pattern) candidate)))) (defun helm-buffers--match-from-mjm (candidate) (let* ((cand (replace-regexp-in-string "^\\s-\\{1\\}" "" candidate)) diff --git a/helm-source.el b/helm-source.el index d31cc42d..0f38509b 100644 --- a/helm-source.el +++ b/helm-source.el @@ -550,7 +550,12 @@ :custom boolean :documentation " Enable migemo. - It will be available for this source once `helm-migemo-mode' is enabled.") + When multimatch is disabled, you can give the symbol 'nomultimatch as value + to force not using generic migemo matching function. + In this case you have to provide your own migemo matching funtion + that kick in when `helm-migemo-mode' is enabled. + Otherwise it will be available for this source once `helm-migemo-mode' + is enabled when non-nil.") (match-strict :initarg :match-strict @@ -620,7 +625,12 @@ inherit from `helm-source'.") :custom boolean :documentation " Enable migemo. - It will be available for this source once `helm-migemo-mode' is enabled.") + When multimatch is disabled, you can give the symbol 'nomultimatch as value + to force not using generic migemo matching function. + In this case you have to provide your own migemo matching funtion + that kick in when `helm-migemo-mode' is enabled. + Otherwise it will be available for this source once `helm-migemo-mode' + is enabled when non-nil.") (candidates :initform 'helm-candidates-in-buffer) @@ -879,11 +889,12 @@ an eieio class." (when (slot-value source 'matchplugin) (set-slot-value source 'match (helm-source-mm-get-search-or-match-fns source 'match))) - (when (and (null (slot-value source 'matchplugin)) - (slot-value source 'migemo)) - (set-slot-value source 'match - (append (helm-mklist (slot-value source 'match)) - '(helm-mm-3-migemo-match))))) + (helm-aif (and (null (slot-value source 'matchplugin)) + (slot-value source 'migemo)) + (unless (eq it 'nomultimatch) ; Use own migemo fn. + (set-slot-value source 'match + (append (helm-mklist (slot-value source 'match)) + '(helm-mm-3-migemo-match)))))) (defmethod helm--setup-source ((source helm-source-in-buffer)) (let ((cur-init (slot-value source 'init))) @@ -908,11 +919,12 @@ an eieio class." (when (slot-value source 'matchplugin) (set-slot-value source 'search (helm-source-mm-get-search-or-match-fns source 'search))) - (when (and (null (slot-value source 'matchplugin)) - (slot-value source 'migemo)) - (set-slot-value source 'search - (append (helm-mklist (slot-value source 'search)) - '(helm-mm-3-migemo-search)))) + (helm-aif (and (null (slot-value source 'matchplugin)) + (slot-value source 'migemo)) + (unless (eq it 'nomultimatch) + (set-slot-value source 'search + (append (helm-mklist (slot-value source 'search)) + '(helm-mm-3-migemo-search))))) (let ((mtc (slot-value source 'match))) (cl-assert (or (equal '(identity) mtc) (eq 'identity mtc)) |