diff options
author | momomo5717 <momomo5717@users.noreply.github.com> | 2015-10-25 08:11:11 +0900 |
---|---|---|
committer | momomo5717 <momomo5717@users.noreply.github.com> | 2015-10-25 08:11:11 +0900 |
commit | 123f4b630fe6bc6316bd7da7c9122e2eaa491118 (patch) | |
tree | 2faca0b1c8254a880e70b8d10aa4f15dff1b9b4c /helm-multi-match.el | |
parent | bfffa29aa9867a6d7fdc2a4525cf4be2d46c6e12 (diff) |
Add helm-mm-migemo-get-pattern, helm-mm-migemo-search-pattern-get (#1175)
for ignoring migemo's invalid regex.
Diffstat (limited to 'helm-multi-match.el')
-rw-r--r-- | helm-multi-match.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/helm-multi-match.el b/helm-multi-match.el index 10fa5004..59b9c0c6 100644 --- a/helm-multi-match.el +++ b/helm-multi-match.el @@ -271,13 +271,22 @@ i.e the sources which have the slot :migemo with non--nil value." (cl-assert (featurep 'migemo) nil "No feature called migemo found, install migemo.el.")) +(defun helm-mm-migemo-get-pattern (pattern) + (let ((regex (migemo-get-pattern pattern))) + (if (ignore-errors (string-match regex "") t) + (concat regex "\\|" pattern) pattern))) + +(defun helm-mm-migemo-search-pattern-get (pattern) + (let ((regex (migemo-search-pattern-get pattern))) + (if (ignore-errors (string-match regex "") t) + (concat regex "\\|" pattern) pattern))) + (defun helm-mm-migemo-string-match (pattern str) "Migemo version of `string-match'." (unless (assoc pattern helm-mm--previous-migemo-info) (with-helm-buffer (setq helm-mm--previous-migemo-info - (push (cons pattern (concat (migemo-get-pattern pattern) - "\\|" pattern)) + (push (cons pattern (helm-mm-migemo-get-pattern pattern)) helm-mm--previous-migemo-info)))) (string-match (assoc-default pattern helm-mm--previous-migemo-info) str)) @@ -292,8 +301,7 @@ i.e the sources which have the slot :migemo with non--nil value." (setq helm-mm--previous-migemo-info (push (cons word (if (delq 'ascii (find-charset-string word)) word - (concat (migemo-search-pattern-get word) - "\\|" word))) + (helm-mm-migemo-search-pattern-get word))) helm-mm--previous-migemo-info)))) (re-search-forward (assoc-default word helm-mm--previous-migemo-info) bound noerror count)) |