Skip to content

Commit

Permalink
emms buffer search supports pinyin
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Mar 3, 2024
1 parent 3971bfb commit be57e47
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lisp/init-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ Copied from 3rd party package evil-textobj."

(defun my-extended-regexp (str)
"Build regex compatible with pinyin from STR."
(let* ((len (length str)))
(let* ((len (length str))
bn)
(cond
;; do nothing
((<= (length str) 1))
Expand All @@ -559,8 +560,9 @@ Copied from 3rd party package evil-textobj."
;; remaining input is converted into Chinese pinyin regex.
((or (and (string-match "[:\|;]" (substring str 0 1))
(setq str (substring str 1 len)))
(and (buffer-name) (or (string= "*Org Agenda*" (buffer-name))
(string-match "\\.org$" (buffer-name)))))
(and (setq bn (buffer-name))
(or (member bn '("*Org Agenda*"))
(string-match ".*EMMS Playlist\\|\\.org$" bn))))
(my-ensure 'pinyinlib)
(setq str (pinyinlib-build-regexp-string str)))

Expand Down

0 comments on commit be57e47

Please sign in to comment.