;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\210\312\313\314\315\316\317\306\303&\210\320\321\322\323\306\303%\207" [require cl-lib custom-declare-group flx nil "Fuzzy matching with good sorting" :group convenience :prefix "flx-" custom-declare-variable flx-word-separators '(32 45 95 58 46 47 92) "List of characters that act as word separators in flx" :type (repeat character) custom-declare-face flx-highlight-face ((t (:inherit font-lock-variable-name-face :bold t :underline t))) "Face used by flx for highlighting flx match characters."] 8) #@36 Check if CHAR is a word character. (defalias 'flx-word-p #[(char) "\205 >?\207" [char flx-word-separators] 2 (#$ . 650)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put flx-word-p speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@42 Check if CHAR is an uppercase character. (defalias 'flx-capital-p #[(char) "\205\211\205 >?)\205\211\226U\207" [char flx-word-separators] 3 (#$ . 918)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put flx-capital-p speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@109 Check if LAST-CHAR is the end of a word and CHAR the start of the next. This function is camel-case aware. (defalias 'flx-boundary-p #[(last-char char) "?\206W\211\205 \211\205 \n>?)\205 \211\226U)\204= \211\2059 \211\2051 \n>?)\2059 \211\226U)\206W\211\205G \n>?)?\205W \211\205V \n>?)\207" [last-char char flx-word-separators] 3 (#$ . 1228)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put flx-boundary-p speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@98 Increment each element of vectory by INC(default=1) from BEG (inclusive) to END (not inclusive). (defalias 'flx-inc-vec #[(vec &optional inc beg end) "\204\306 \204\f\307\n\204 G \nW\203.  \f \f H\\I\210* T\211\202 \207" [inc beg end vec #1=#:v #2=#:v 1 0] 5 (#$ . 1744)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put flx-inc-vec speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@118 Return hash-table for string where keys are characters. Value is a sorted list of indexes for character occurrences. (defalias 'flx-get-hash-for-string #[(str heatmap-func) "\306\307\310\311\312$ G\313\nS\313\314\f\315Y\203x \fH\211\211\2057 \211\205/ >?)\2057 \211\226U)\203W \316\f\317\"B#\210* \227\202Y  \316\f\317\"B#\210*\fS\313\202+\316\320 !#\210+\207" [res str str-len down-char index char make-hash-table :test eq :size 32 nil t 0 puthash gethash heatmap #1=#:--cl-var-- flx-word-separators #2=#:v #3=#:v #4=#:v #5=#:v heatmap-func] 7 (#$ . 2177)]) #@70 Generate the heatmap vector of string. See documentation for logic. (defalias 'flx-get-heatmap-str #[(str &optional group-separator) "G\211S\306 \307\"\310\311\312DC \nHTI\210*\311\313\312\313\312T\211\203]GW\203]H\312U?\205Z\211\211?\206\320\211\205\207\211\205~>?)\205\207\211\226U)\204\256\211\205\252\211\205\241>?)\205\252\211\226U)\206\320\211\205\274>?)?\205\320\211\205\317>?)*\203\340 @A @AAB\241\210\211\205\356>?)\204 \211\205>?)\203 T)\f=\203& H\314\\I\210* =\203@ @A\240\210\312D B\nU\203Q @A\240\210\202UT\2027. G\211!S\211\"\312U\204\302 \315!_\313\211#$%&%\204\204\316%$\204\214\312$#\204\226&G#$#W\203\276&'$('('(H%\\I\210*$T\211$\202\230&,\210 )\313*\"\313\211+,):\2031)@*\312Y\2031*@*A@*AAG\313-./0.\312U\204 ,\204 \317\211,-\3131-\203*\320\"\316V\203!\"S\202\"\312\\/[\\\202:\312U\2035\321\202:\322S\\1 10T+#$%&%\204T\316%$\204\\\312$#\204f&G#$#W\203\216&'$('('(H%\\I\210*$T\211$\202h&,\210)*AA2\3133.S4+\206\247 52:\2032@34\312Y\203 6376767H\323\\I\210*358\31298W\203  :;:;:;H\3214_9Z\\I\210*T9T9\202\333+352A24S4\202\251,0T+,)A)S\202\322. -\207" [str str-len str-last-index scores penalty-lead groups-alist make-vector -35 46 -1 0 nil -45 -2 1 t 35 -3 -5 85 #1=#:v #2=#:v #3=#:--cl-vec-- #4=#:--cl-idx-- char index last-char group-word-count effective-last-char flx-word-separators #5=#:v #6=#:v group-separator group-count separator-count end beg inc vec #7=#:v #8=#:v #9=#:--cl-var-- group last-group-limit basepath-found basepath-p words-length word-count group-start num #10=#:--cl-var-- word word-index last-word #11=#:v #12=#:v #13=#:--cl-var-- char-i #14=#:v #15=#:v] 6 (#$ . 2797)]) #@37 Return heatmap vector for filename. (defalias 'flx-get-heatmap-file #[(filename) "\301\302\"\207" [filename flx-get-heatmap-str 47] 3 (#$ . 4784)]) #@94 Return sublist bigger than VAL from sorted SORTED-LIST if VAL is nil, return entire list. (defalias 'flx-bigger-sublist #[(sorted-list val) "\203&\3032' \211:\203\"\n@V\203\304\303\n\"\210\nA\211\202 )\3050\207 \207" [val sorted-list sub --cl-block-nil-- throw nil] 4 (#$ . 4939)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put flx-bigger-sublist speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@59 Return cache hashtable appropriate for storing filenames. (defalias 'flx-make-filename-cache #[nil "\300\301!\207" [flx-make-string-cache flx-get-heatmap-file] 2 (#$ . 5384)]) #@57 Return cache hashtable appropriate for storing strings. (defalias 'flx-make-string-cache #[(&optional heat-func) "\302\303\304\305\306$\307\310 \206\311#\210)\207" [hash heat-func make-hash-table :test equal :size 4096 puthash heatmap-func flx-get-heatmap-str] 5 (#$ . 5566)]) #@57 Get calculated heatmap from cache, add it if necessary. (defalias 'flx-process-cache #[(str cache) "\205\303 \"\211\206(\304 \203\303\305\"\206\306\"\203'\307 \n#\210\n)\207" [cache str res gethash flx-get-hash-for-string heatmap-func flx-get-heatmap-str puthash] 6 (#$ . 5854)]) #@202 Recursively compute the best match for a string, passed as STR-INFO and HEATMAP, according to QUERY. This function uses MATCH-CACHE to memoize its return values. For other parameters, see `flx-score' (defalias 'flx-find-best-match #[(str-info heatmap greater-than query query-length q-index match-cache) " \206\306\n_\\\307 \f\"\211\203 \310=?\205( \202(\307H\" \203[\3112]\211:\203U@V\203L\312\311\"\210A\211\2029)\3130\202]*\313\211\nSY\203{\314\315\"\202\313\211\203@\316 \nT\f&\313!\211\203\n@\211!@@SU\203\311\317!A@ H!AA\320^\321_\322$\202\323!A@ H\\\211V\203!@B!@@SU\203\373!AAT\202\374\306BBCA\211\204\243*A\211\204\206*\323 \203!\202\"\310\f#\210,*\207" [q-index greater-than query-length hash-key match-cache hash-value 0 gethash no-match --cl-block-nil-- throw nil mapcar #[(index) "C H\302BB\207" [index heatmap 0] 3] flx-find-best-match + 3 15 60 puthash query str-info val sorted-list sub most-negative-fixnum best-score temp-score match indexes index --dolist-tail-- heatmap elem] 9 (#$ . 6157)]) #@46 Return best score matching QUERY against STR (defalias 'flx-score #[(str query &optional cache) "G\306U\206 G\306U?\205l\307 \n\"\310\304 \"G\311 W\205% \312W\313\314\315\316\317\320\321$\322 \f\323 \306&\211\205j\203`@@G GU\203`@A@\314\\\202e@A@@@B.\207" [query str cache str-info heatmap query-length 0 flx-process-cache gethash 1 5 5000 10000 make-hash-table :test eql :size 10 flx-find-best-match nil full-match-boost max-lisp-eval-depth max-specpdl-size match-cache optimal-match] 9 (#$ . 7320)]) #@97 Return propertized copy of obj according to score. SCORE of nil means to clear the properties. (defalias 'flx-propertize #[(obj score &optional add-score) "A@\306 :\203\307 @!\202\307 !\203_A\306\211 \203I @ \203> T U\204>\310\f T\311\312\n%\210   A\211 \204$*\310\f T\311\312\n%\210\203_\313\314\n@# :\203k\n AB\202l\n+\207" [score obj str last-char block-started char nil substring-no-properties put-text-property face flx-highlight-face format "%s [%s]" --dolist-tail-- add-score] 7 (#$ . 7866)]) #@36 Cached heatmap info about strings. (defvar flx-file-cache nil (#$ . 8403)) (byte-code "\301 \301\207" [flx-file-cache flx-make-filename-cache] 1) #@38 Cached heatmap info about filenames. (defvar flx-strings-cache nil (#$ . 8556)) (byte-code "\301 \302\303!\207" [flx-strings-cache flx-make-string-cache provide flx] 2)