;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\302\303\304\305\306\301%\210\307\310\311\312\313DD\314\315\316\317\320\321\322& \210\307\323\311\312\324DD\325\315\326%\210\307\327\311\312\330DD\331\315\332%\210\307\333\311\312\334DD\335\315\332%\210\307\336\311\312\337DD\340\315\312%\210\307\341\311\312\342DD\343\315\312%\210\307\344\311\312\345DD\346\315\312%\207" [require company custom-declare-group company-statistics nil "Completion candidates ranking by historical statistics." :group custom-declare-variable company-statistics-size funcall function #[0 "\300\207" [400] 1] "Number of completion choices that `company-statistics' keeps track of.\nAs this is a global cache, making it too small defeats the purpose." :type integer :initialize custom-initialize-default :set company-statistics--log-resize company-statistics-file #[0 "\301P\207" [user-emacs-directory "company-statistics-cache.el"] 2] "File to save company-statistics state." string company-statistics-auto-save #[0 "\300\207" [t] 1] "Whether to save the statistics when leaving emacs." boolean company-statistics-auto-restore #[0 "\300\207" [t] 1] "Whether to restore statistics when company-statistics is enabled and has\nnot been used before." company-statistics-capture-context #[0 "\300\207" [company-statistics-capture-context-heavy] 1] "Function called with single argument (t if completion started manually).\nThis is the place to store any context information for a completion run." company-statistics-score-change #[0 "\300\207" [company-statistics-score-change-heavy] 1] "Function called with completion choice. Using arbitrary other info,\nit should produce an alist, each entry labeling a context and the\nassociated score update: ((ctx-a . 1) (\"str\" . 0.5) (nil . 1)). Nil is\nthe global context." company-statistics-score-calc #[0 "\300\207" [company-statistics-score-calc-heavy] 1] "Function called with completion candidate. Using arbitrary other info,\neg, on the current context, it should evaluate to the candidate's score (a\nnumber)."] 10) #@60 Store selection frequency of candidates in given contexts. (defvar company-statistics--scores nil (#$ . 2107)) #@43 Ring keeping a log of statistics updates. (defvar company-statistics--log nil (#$ . 2224)) #@21 Index into the log. (defvar company-statistics--index nil (#$ . 2321)) #@32 Initialize company-statistics. (defalias 'company-statistics--init #[0 "\304\305\306\307$\310\311\"\312\211\207" [company-statistics-size company-statistics--scores company-statistics--log company-statistics--index make-hash-table :test equal :size make-vector nil 0] 5 (#$ . 2398)]) (defalias 'company-statistics--initialized-p #[0 "\301!\207" [company-statistics--scores hash-table-p] 2]) #@24 (fn OPTION NEW-SIZE) (defalias 'company-statistics--log-resize #[514 "\303 \203e\304\305\"G\306\307 ^S\"\211\2030\211@\310\nZ\\ \"HI\266A\266\202\202\210 W\203U\306\n \n\\S\\\"\211\203T\211@\311\310 \"!\210A\266\202\202@\210\211 X\203a\307\202b )\210\211\211\207" [company-statistics--log company-statistics-size company-statistics--index company-statistics--initialized-p make-vector nil number-sequence 0 mod company-statistics--log-revert] 10 (#$ . 2801)]) #@18 Save statistics. (defalias 'company-statistics--save #[0 "\306\307\310\"r\211q\210\311\312\"\216\313\314!\210\314\211\315\316\317\320\302\n\303 \304\f\257\"\321\314p$\210\322\323\314\211#-\207" [print-length print-level company-statistics--scores company-statistics--log company-statistics--index coding-system-for-write generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] set-buffer-multibyte nil encode-coding-string format "%S" setq utf-8 binary write-region company-statistics-file] 11 (#$ . 3298)]) (defalias 'company-statistics--maybe-save #[0 "\301 \205 \205 \302 \207" [company-statistics-auto-save company-statistics--initialized-p company-statistics--save] 1]) #@21 Restore statistics. (defalias 'company-statistics--load #[0 "\301\302\303\304$\207" [company-statistics-file load noerror nil nosuffix] 5 (#$ . 4045)]) #@53 Count for global score and mode context. (fn CAND) (defalias 'company-statistics-score-change-light #[257 "\301\302B\302BD\207" [major-mode nil 1] 4 (#$ . 4204)]) #@61 Global score, and bonus for matching major mode. (fn CAND) (defalias 'company-statistics-score-calc-light #[257 "\302\"\211\203\303\236A\206\304\305 \"A\206\304\\\207\304\207" [company-statistics--scores major-mode gethash nil 0 assoc] 6 (#$ . 4375)]) #@71 Current completion context, a list of entries searched using `assoc'. (defvar company-statistics--context nil (#$ . 4644)) #@104 Return last keyword, ie, text of region fontified with the font-lock-keyword-face up to point, or nil. (defalias 'company-statistics--last-keyword #[0 "`\300!\203\"eW\203\"\301S\302\"\303=\204\"\304\302\305e$\262\202\300!\205?\301eS]\302\"\303=\205?\306\307\304\302\305e$\"D\207" [number-or-marker-p get-text-property face font-lock-keyword-face previous-single-property-change nil :keyword buffer-substring-no-properties] 8 (#$ . 4774)]) #@128 Return symbol immediately preceding current completion prefix, or nil. May be separated by punctuation, but not by whitespace. (defalias 'company-statistics--parent-symbol #[0 "\212\300\301!\302U?\205\303\304\305 !!)\211\205\306D\207" [skip-syntax-backward "." 0 substring-no-properties symbol-name symbol-at-point :symbol] 3 (#$ . 5236)]) #@34 Return buffer file name, or nil. (defalias 'company-statistics--file-name #[0 "\205\301D\207" [buffer-file-name :file] 2 (#$ . 5587)]) #@73 Calculate some context, once for the whole completion run. (fn MANUAL) (defalias 'company-statistics-capture-context-heavy #[257 "\212G\206\302[u\210\303\304\305 \306 \307 E\"\211)\207" [company-prefix company-statistics--context 1 delq nil company-statistics--last-keyword company-statistics--parent-symbol company-statistics--file-name] 6 (#$ . 5732)]) #@97 Count for global score, mode context, last keyword, parent symbol, buffer file name. (fn CAND) (defalias 'company-statistics-score-change-heavy #[257 "\302\236\303\236\304\236\305\306B \306BD\205\306BC\244\205!\306BC\244\205*\306BC\244\207" [company-statistics--context major-mode :keyword :symbol :file nil 1] 7 (#$ . 6098)]) #@108 Global score, and bonus for matching major mode, last keyword, parent symbol, buffer file name. (fn CAND) (defalias 'company-statistics-score-calc-heavy #[257 "\303\"\304 \236\305 \236\306 \236\203S\307\310\236A\206\311\312\n\"A\206$\311\205.\312\"A\2063\311\205=\312 \"A\206B\311\205L\312\n\"A\206Q\311%\207\311\207" [company-statistics--scores company-statistics--context major-mode gethash :keyword :symbol :file + nil 0 assoc] 13 (#$ . 6446)]) #@380 Return new alist with conses from ALIST. Their cdrs are updated to (merger cdr update-cdr) if the UPDATES alist contains an entry with an equal-matching car. If FILTER called with the result is non-nil, remove the cons from the result. If no matching cons exists in ALIST, add the new one. ALIST structure and cdrs may be changed! (fn ALIST UPDATES MERGER &optional FILTER) (defalias 'company-statistics--alist-update #[1027 "\211\206\300C\301C\302\303\304 &\"\210\242\242\244\207" [ignore nil mapc make-closure #[257 "\305@\300\"\211\203!\301AA\"\302!\203\303\306\303\242\"\240\207\241\207\304\304\242B\240\207" [V0 V1 V2 V3 V4 assoc delete] 7 "\n\n(fn UPD)"]] 15 (#$ . 6931)]) #@27 (fn CAND SCORE-UPDATES) (defalias 'company-statistics--scores-add #[514 "\301\302\303\"\304##\207" [company-statistics--scores puthash company-statistics--alist-update gethash +] 8 (#$ . 7649)]) #@107 Revert score updates for log entry. INDEX defaults to `company-statistics--index'. (fn &optional INDEX) (defalias 'company-statistics--log-revert #[256 "\206 H\211\205(\211@A\303\304\n\"\305\306$\211\203\"\307\n#\207\310\n\"\266\203\207" [company-statistics--log company-statistics--index company-statistics--scores company-statistics--alist-update gethash - zerop puthash remhash] 9 (#$ . 7858)]) #@82 Insert/overwrite result and associated score updates. (fn RESULT SCORE-UPDATES) (defalias 'company-statistics--log-store #[514 " BI\210\303 T\n\"\211\207" [company-statistics--log company-statistics--index company-statistics-size mod] 6 (#$ . 8276)]) #@15 (fn MANUAL) (defalias 'company-statistics--start #[257 "!\207" [company-statistics-capture-context] 3 (#$ . 8538)]) #@55 After completion, update scores and log. (fn RESULT) (defalias 'company-statistics--finished #[257 "!\301!\302\"\210\303 \210\304\"\207" [company-statistics-score-change substring-no-properties company-statistics--scores-add company-statistics--log-revert company-statistics--log-store] 6 (#$ . 8664)]) #@140 Sort candidates by historical statistics. Stable sort, so order is only changed for candidates distinguishable by score. (fn CANDIDATES) (defalias 'company-sort-by-statistics #[257 "\300\301\"\211\262\207" [sort #[514 "!!V\207" [company-statistics-score-calc] 5 "\n\n(fn CAND1 CAND2)"]] 4 (#$ . 8982)]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313& \207" [custom-declare-variable company-statistics-mode funcall function #[0 "\300\207" [nil] 1] "Non-nil if Company-Statistics mode is enabled.\nSee the `company-statistics-mode' command\nfor a description of this minor mode.\nSetting this variable directly does not take effect;\neither customize it (see the info node `Easy Customization')\nor call the function `company-statistics-mode'." :set custom-set-minor-mode :initialize custom-initialize-default :type boolean] 10) #@1048 Statistical sorting for company-mode. Ranks completion candidates by the frequency with which they have been chosen in recent (as given by `company-statistics-size') history. This is a minor mode. If called interactively, toggle the `Company-Statistics mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `(default-value 'company-statistics-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. Turning this mode on and off preserves the statistics. They are also preserved automatically between Emacs sessions in the default configuration. You can customize this behavior with `company-statistics-auto-save', `company-statistics-auto-restore' and `company-statistics-file'. (fn &optional ARG) (defalias 'company-statistics-mode #[256 "\305 \306\301\307=\203\310\301!?\202!\247\203 \311W\203 \312\202!\313\"\210\314\300!\2038\315\301\"\310\301!\2038\301B \203h\316 \204U\n\203R\317 \203R\320\312 \"\210\202U\321 \210\322\304\323\324#\210\325\326\327\"\210\325\330\331\"\210\202w\315\323\f\"\332\326\327\"\210\332\330\331\"\210\333\334\310\301!\203\203\335\202\204\336\"\210\337\340!\203\254\341\301!\210\305 \203\234\211\305 \232\203\254\342\343\310\301!\203\250\344\202\251\345\346#\210\210\347 \210\310\301!\207" [global-minor-modes company-statistics-mode company-statistics-auto-restore company-statistics-size company-transformers current-message set-default toggle default-value 1 nil t boundp delq company-statistics--initialized-p company-statistics--load company-statistics--log-resize company-statistics--init add-to-list company-sort-by-statistics append add-hook company-completion-started-hook company-statistics--start company-completion-finished-hook company-statistics--finished remove-hook run-hooks company-statistics-mode-hook company-statistics-mode-on-hook company-statistics-mode-off-hook called-interactively-p any customize-mark-as-set message "Company-Statistics mode %sabled%s" "en" "dis" "" force-mode-line-update] 6 (#$ . 9841) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar company-statistics-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\310\313\300!\205#\310\211%\210\314\315\316\"\210\317\320!\207" [company-statistics-mode-map company-statistics-mode-hook variable-documentation put "Hook run after entering or leaving `company-statistics-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode company-statistics-mode boundp add-hook kill-emacs-hook company-statistics--maybe-save provide company-statistics] 6)