oantolin / orderless

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

Add orderless--match-p helper #165

Closed minad closed 8 months ago

minad commented 8 months ago

This is a small follow up of #162. It makes it a little simpler to write additional matchers, for example the * mode matcher from Helm:

(defun +orderless-mode (pred regexp)
  (lambda (str)
    (when-let ((buf (get-buffer (or (cdr (get-text-property 0 'multi-category str)) str)))
               (mode (buffer-local-value 'major-mode buf)))
      (orderless--match-p pred regexp (symbol-name mode)))))

(setf (alist-get ?* orderless-affix-dispatch-alist) #'+orderless-mode)
oantolin commented 8 months ago

Thanks! The helper already simplifies the two modifiers and will make it easier to write others.

But especially thank you for the name "modifiers" and writing the documentation. 😄

minad commented 8 months ago

Thanks for merging! I think the documentation should still be overhauled a little bit, maybe with more examples, and also explaining the new concepts better. But is a start at least. :)