XahTV 2021-04-20 Emacs Lisp. Explore Helm Fuzzy Match Source Code. Part 3
- https://youtu.be/SD47M6hFcmE?t=2503 review of helm home page and documentation
We are going to explore the elisp source code of helm mode, to see how it implement fuzzy matching.
- History of helm.
- the origin of dynamic search User Interface: Mac software Quicksilver (qsapp.com)
- helm home page https://emacs-helm.github.io/helm/
(defun select-choices () "Select from a list of predefine choices, then insert them into buffer. version 2021-04-18 " (interactive) (let ( (phrases '( "This heart follows the brain of __" "This field closely follows the paradigm of __" "Widely considered to be a good way to __" "This has been widely adopted in the field of __" "This is more widely used at the time of __" "This phenomenon has been widely observed" "A common technique is to __" "This is a technique common in __" "There are several common kinds of __" )) userChoice ) (setq userChoice (ido-completing-read "Make a choice:" phrases )) (insert userChoice) ;; )) ;; ido fuzzy matching is a character based fuzzy matching, and order matters ;; now let's explore helm's helm-M-x. It is a word based fuzzy matching, and order does not matter. ;; now, let's look at helm's implementation of M-x: helm-M-x ;; helm-M-x call stack (helm-M-x) (helm-M-x-read-extended-command obarray) (helm :sources sources :prompt prompt :buffer "*helm M-x*" :history 'helm-M-x-input-history) (t #'helm-internal) (apply fn plist) (helm-internal &optional SOURCES INPUT PROMPT RESUME PRESELECT BUFFER KEYMAP DEFAULT HISTORY) (helm-read-from-minibuffer prompt input preselect resume keymap default history) ;; btw, emacs 27 has string-distance ;; so, in helm, they use the word fuzzy-matching to mean some sort of fuzzy matching. but, the helm-M-x is actualy not using helm's fuzzy match, but let's call it orderless word based matching. ;; where is the doc for helm API