Skip to content

Commit

Permalink
Merge pull request #1245 from momomo5717/add_check-migemo-regex
Browse files Browse the repository at this point in the history
Add helm-mm-migemo-get-pattern, helm-mm-migemo-search-pattern-get
  • Loading branch information
Thierry Volpiatto committed Oct 25, 2015
2 parents bfffa29 + 123f4b6 commit 416fb4c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions helm-multi-match.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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))
Expand Down

0 comments on commit 416fb4c

Please sign in to comment.