]>
Commit | Line | Data |
---|---|---|
53e6db90 DC |
1 | ;ELC\1c\0\0\0 |
2 | ;;; Compiled | |
3 | ;;; in Emacs version 28.2 | |
4 | ;;; with all optimizations. | |
5 | ||
6 | ||
7 | ||
8 | (byte-code "\300\301!\210\302\303\304\305\306\307%\207" [require cl-lib custom-declare-face company-template-field ((((background dark)) (:background "yellow" :foreground "black")) (((background light)) (:background "orange" :foreground "black"))) "Face used for editable text in template fields." :group company-faces] 6) | |
9 | (defvar company-template-forward-field-item '(menu-item "" company-template-forward-field :filter company-template--keymap-filter)) | |
10 | (defvar company-template-nav-map (byte-code "\302 \18\303\b\304 #\210\303\b\305 #\210\b)\207" [keymap company-template-forward-field-item make-sparse-keymap define-key [tab] " "] 4)) | |
11 | (defvar company-template-clear-field-item '(menu-item "" company-template-clear-field :filter company-template--keymap-filter)) | |
12 | (defvar company-template-field-map (byte-code "\303 \18\304\b \"\210\305\b\306\n#\210\b)\207" [keymap company-template-nav-map company-template-clear-field-item make-sparse-keymap set-keymap-parent define-key "\ 4"] 4)) | |
13 | (defvar company-template--buffer-templates nil nil) | |
14 | (make-variable-buffer-local 'company-template--buffer-templates) | |
15 | (defalias 'company-template-templates-at #[(pos) "\305\18\306 !\305\1a\211\e\203 \0\v@\211\12\f>\203\19\0\n\bB\10\vA\211\13\204\f\0*\b)\207" [os pos o --dolist-tail-- company-template--buffer-templates nil overlays-at] 3]) | |
16 | (defalias 'company-template-move-to-first #[(templ) "\301\b!b\210\302 \207" [templ overlay-start company-template-forward-field] 2 nil nil]) | |
17 | (defalias 'company-template-forward-field #[nil "`\302 \18\19\303 \210\bb\210\304\305 !!*\207" [next-field-start start company-template-find-next-field push-mark company-template-remove-field company-template-field-at] 3 nil nil]) | |
18 | #@27 Clear the field at point.\1f | |
19 | (defalias 'company-template-clear-field #[nil "\302`!\211\18\205\e\0\303\b\304\"\210\305\b\306\"\19\307 !\205\1a\0 ))\207" [ovl after-clear-fn company-template-field-at company-template-remove-field t overlay-get company-template-after-clear functionp] 4 (#$ . 1744) nil]) | |
20 | (defalias 'company-template--keymap-filter #[(cmd) "\301\302!?\205\b\0\b\207" [cmd run-hook-with-args-until-success yas-keymap-disable-hook] 2]) | |
21 | #@309 Function that can be called after deleting a field of a c-like template. | |
22 | For c-like templates it is set as `after-post-fn' property on fields in | |
23 | `company-template-add-field'. If there is a next field, delete everything | |
24 | from point to it. If there is no field after point, remove preceding comma | |
25 | if present.\1f | |
26 | (defalias 'company-template--after-clear-c-like-field #[nil "`\18\303 \19\304 !?\211\1a\204$\0\b W\203$\0\305\306\307\b \"\"\203$\0\b |\2024\0\n\2054\0\310\311\312 \"\2054\0\313\224\b|+\207" [pos next-field-start last-field-p company-template-find-next-field company-template-field-at string-match "^[ ]*,+[ ]*$" buffer-substring-no-properties looking-back ",+[ ]*" line-beginning-position 0] 6 (#$ . 2182)]) | |
27 | (defalias 'company-template-find-next-field #[nil "`\18\306\b!\19\307\310\311\312 \"\"\1a \e\313\211\1c\1d\v:\203,\0\v@\14\314\315\f\316\"!\r\244\15\vA\211\13\202\15\0\r\237+\1e\10\311\317\ e\10\"\313\1e\11\211\1e\12\203b\0\ e\12@\211\16\11\203Y\0\ e\11\bV\203Y\0\ e\11\nW\203Y\0\ e\11\12\ e\12A\211\16\12\204?\0\313\16\11\n.\ 6\207" [start templates minimum #1=#:--cl-var-- templ #2=#:--cl-var-- company-template-templates-at apply max mapcar overlay-end nil reverse overlay-get company-template-fields overlay-start fields pos --dolist-tail--] 6]) | |
28 | (defalias 'company-template-field-at #[(&optional point) "\305\b\206\ 6\0`!\19\306\1a\307\e\306\1c :\2030\0 @\12\310\n\311\"\203%\0\n\14\306\211\13\202&\0\307\2030\0 A\211\11\202\ f\0\f,\207" [point #1=#:--cl-var-- ovl #2=#:--cl-var-- #3=#:--cl-var-- overlays-at nil t overlay-get company-template-parent] 4]) | |
29 | (defalias 'company-template-declare-template #[(beg end) "\305\b \"\1a\306\n\307\v#\210\306\n\310\311#\210\306\n\312\313#\210\n\fB\14\314\315\316\317\313$\210\n)\207" [beg end ov company-template-nav-map company-template--buffer-templates make-overlay overlay-put keymap priority 101 evaporate t add-hook post-command-hook company-template-post-command nil] 5]) | |
30 | (defalias 'company-template-remove-template #[(templ) "\302\303\304\b\305\"\"\210\306\b \"\11\307\b!\207" [templ company-template--buffer-templates mapc company-template-remove-field overlay-get company-template-fields delq delete-overlay] 5]) | |
31 | #@295 Add new field to template TEMPL spanning from BEG to END. | |
32 | When DISPLAY is non-nil, set the respective property on the overlay. | |
33 | Leave point at the end of the field. | |
34 | AFTER-CLEAR-FN is a function that can be used to apply custom behavior | |
35 | after deleting a field in `company-template-remove-field'.\1f | |
36 | (defalias 'company-template-add-field #[(templ beg end &optional display after-clear-fn) "\b\204\b\0\306\300!\210 \307\b!V\203\18\0\310\b\311\b! #\210\312\n \"\313\b\314\"\e\1c\315\f\316\317#\210\315\f\320\321#\210\r\2038\0\315\f\305\r#\210\315\f\322\b#\210\315\f\323\324#\210\ e\19\203P\0\315\f\325\ e\19#\210\315\f\326\ e\1a#\210\315\f\327\330#\210\f\vB\13\315\b\314\v#*\207" [templ end beg siblings ov display cl--assertion-failed overlay-end move-overlay overlay-start make-overlay overlay-get company-template-fields overlay-put intangible t face company-template-field company-template-parent insert-in-front-hooks (company-template-insert-hook) company-template-after-clear keymap priority 101 after-clear-fn company-template-field-map] 4 (#$ . 4234)]) | |
37 | (defalias 'company-template-remove-field #[(ovl &optional clear) "\304\b!\2051\0\305\b!\203\1c\0 \203\18\0\306\b!\307\b!|\210\310\b!\210\311\b\312\"\1a\311\n\313\"\e\314\b\v\"\13\315\n\313\v#*\207" [ovl clear templ siblings overlayp overlay-buffer overlay-start overlay-end delete-overlay overlay-get company-template-parent company-template-fields delq overlay-put] 4]) | |
38 | #@48 Clean up all templates that don't contain POS.\1f | |
39 | (defalias 'company-template-clean-up #[(&optional pos) "\305\b\206\ 6\0`!\19\n\306\e\211\1c\205%\0\f@\211\13 >\204\1d\0\307\v!\210\fA\211\14\204\10\0\306+\207" [pos local-ovs company-template--buffer-templates templ --dolist-tail-- overlays-at nil company-template-remove-template] 3 (#$ . 5609)]) | |
40 | #@49 Called when a snippet input prompt is modified.\1f | |
41 | (defalias 'company-template-insert-hook #[(ovl after-p &rest _ignore) "\b?\205 \0\302 \303\"\207" [after-p ovl company-template-remove-field t] 3 (#$ . 5939)]) | |
42 | (defalias 'company-template-post-command #[nil "\301 \210\b?\205\r\0\302\303\304\305#\207" [company-template--buffer-templates company-template-clean-up remove-hook post-command-hook company-template-post-command t] 4]) | |
43 | (defalias 'company-template-c-like-templatify #[(call) "\306 \18` GZ\1a\307\n\b\"\e\310\211\1c\1d\311 p\1e\1f\1e \312\216\313\314\311 !!\210\315\316\317\"\210\315\320\321\"\210\322\321\n\323#\203F\0\306 \15\324u\210`\b|\210\325 \210\324u\210\306 \14\322\326\n\323#\203b\0\306 \1e!\324u\210\325 \210\310u\210\327\v\ e!\"\210)\330\331\332 \"\203p\0\324\224\324\225|\210\f\203|\0\fb\210\327\v\r\"\210+\333\v\334\"\203\212\0\335\v!\202\220\0\336\v!\210\bb-\207" [end call beg templ paren-open paren-close point-marker company-template-declare-template nil syntax-table #[nil "r\bq\210\302 !)\207" [#1=#:buffer #2=#:table set-syntax-table] 2] set-syntax-table make-syntax-table modify-syntax-entry 60 "(" 62 ")" search-backward t 1 backward-sexp ">" company-template--c-like-args looking-back "\\((\\*)\\)(" line-beginning-position overlay-get company-template-fields company-template-move-to-first company-template-remove-template #1# #2# angle-close] 5]) | |
44 | (defalias 'company-template--c-like-args #[(templ end) "`\18\303\304 \305#\205&\0\306\b`\"@\307U\203\ 2\0\310\n\b\311\225\312\313%\210\314\312w\210`\10\202\ 2\0)\207" [last-pos end templ re-search-forward "\\([^,]+\\),?" move parse-partial-sexp 0 company-template-add-field 1 nil company-template--after-clear-c-like-field " "] 6]) | |
45 | (defalias 'company-template-objc-templatify #[(selector) "\305 \18` GZS\1a\306\n\b\"\e\307\1c\212\nb\210\3102W\0\311\312\b\313#\205V\0\314\315!\2030\0\316\v`\317\225#\210\202H\0\316\v`\320\321\f\"c\210`#\210`\bW\203E\0\322c\210\fT\14`\bY\203\18\0\323\310\313\"\210\202\18\00\210)\324\v!,\207" [end selector beg templ cnt point-marker company-template-declare-template 0 stop search-forward ":" t looking-at "\\(([^)]*)\\) ?" company-template-add-field 1 format "arg%d" " " throw company-template-move-to-first] 6]) | |
46 | (provide 'company-template) |