jrblevin/deft

Support custom filters?

ErnestDong opened this issue · 1 comments

My notes are written in Chinese, which can search more comfortably with something called pinyin(just in latin letters). I can custom search filters of ivy or vertico, like

(defun completion--regex-pinyin (str)
  (orderless-regexp (pinyinlib-build-regexp-string str)))
(add-to-list 'orderless-matching-styles 'completion--regex-pinyin)

I also see #59 and #68 relevant to this. Could you please support custom filters like that? e.g.

(define my-custom-deft-filters()
 (regexp something))
(sets deft-filters 'my-custom-deft-filters())

Thank you for your awesome packages!

  (defun deft-search-forward (str)
    "Function to use when matching files against filter strings STR.
This function calls `search-forward' when `deft-incremental-search'
is non-nil and `re-search-forward' otherwise."
    (let ((case-fold-search deft-case-fold-search))
      (if deft-incremental-search
          (search-forward str nil t)
        (re-search-forward (pinyinlib-build-regexp-string str) nil t))))

my solution