oantolin / orderless

Emacs completion style that matches multiple regexps in any order
GNU General Public License v3.0
776 stars 27 forks source link

consult-locate not supported Chinese Pinyin first letter search #172

Closed 1925381584 closed 7 months ago

1925381584 commented 7 months ago

hi,when I set like below, consult-buffer can supported chinese pinyin first letter search, but consult-locate does not take effect. Can you see what the problem is

(defun orderless-regexp-pinyin (str) (setf (car str) (pinyinlib-build-regexp-string (car str))) str) (advice-add 'orderless-regexp :filter-args #'orderless-regexp-pinyin)

minad commented 7 months ago

Maybe you want to use Orderless also as pattern compiler for consult-grep etc? See https://github.com/minad/consult/wiki#use-orderless-as-pattern-compiler-for-consult-grepripgrepfind.

However consult-locate is a special command since locate does not necessarily understand regular expressions, since these won't work efficiently with the locate database index.

1925381584 commented 7 months ago

yes, as you say, first locate database index need support Chinese Pinyin first letter search,if it don't support, when you send "nh" to locate, it can't answer you "你好"

minad commented 7 months ago

I just took another look at consult--locate-builder. This function builds the locate command line, splits the input argument and then passes the input unmodified to locate, because of what I wrote above about the database index. Integrating Pinyin is therefore not supported, but it may be possible to override the function with one which transforms the input first. I close this issue, since it is not an Orderless issue.