;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (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) (defvar company-template-forward-field-item '(menu-item "" company-template-forward-field :filter company-template--keymap-filter)) (defvar company-template-nav-map (byte-code "\302 \303\304 #\210\303\305 #\210)\207" [keymap company-template-forward-field-item make-sparse-keymap define-key [tab] " "] 4)) (defvar company-template-clear-field-item '(menu-item "" company-template-clear-field :filter company-template--keymap-filter)) (defvar company-template-field-map (byte-code "\303 \304 \"\210\305\306\n#\210)\207" [keymap company-template-nav-map company-template-clear-field-item make-sparse-keymap set-keymap-parent define-key ""] 4)) (defvar company-template--buffer-templates nil nil) (make-variable-buffer-local 'company-template--buffer-templates) (defalias 'company-template-templates-at #[(pos) "\305\306 !\305\211\203 @\211\f>\203\nB A\211\204\f*)\207" [os pos o --dolist-tail-- company-template--buffer-templates nil overlays-at] 3]) (defalias 'company-template-move-to-first #[(templ) "\301!b\210\302 \207" [templ overlay-start company-template-forward-field] 2 nil nil]) (defalias 'company-template-forward-field #[nil "`\302 \303 \210b\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]) #@27 Clear the field at point. (defalias 'company-template-clear-field #[nil "\302`!\211\205\303\304\"\210\305\306\"\307 !\205 ))\207" [ovl after-clear-fn company-template-field-at company-template-remove-field t overlay-get company-template-after-clear functionp] 4 (#$ . 1747) nil]) (defalias 'company-template--keymap-filter #[(cmd) "\301\302!?\205\207" [cmd run-hook-with-args-until-success yas-keymap-disable-hook] 2]) #@309 Function that can be called after deleting a field of a c-like template. For c-like templates it is set as `after-post-fn' property on fields in `company-template-add-field'. If there is a next field, delete everything from point to it. If there is no field after point, remove preceding comma if present. (defalias 'company-template--after-clear-c-like-field #[nil "`\303 \304 !?\211\204$ W\203$\305\306\307 \"\"\203$ |\2024\n\2054\310\311\312 \"\2054\313\224|+\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 (#$ . 2185)]) (defalias 'company-template-find-next-field #[nil "`\306!\307\310\311\312 \"\" \313\211 :\203, @\314\315\f\316\"! \244 A\211\202 \237+\311\317\"\313\211\203b@\211\203YV\203Y\nW\203YA\211\204?\313\n.\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]) (defalias 'company-template-field-at #[(&optional point) "\305\206`!\306\307\306 :\2030 @\310\n\311\"\203%\n\306\211\202&\307\2030 A\211\202\f,\207" [point #1=#:--cl-var-- ovl #2=#:--cl-var-- #3=#:--cl-var-- overlays-at nil t overlay-get company-template-parent] 4]) (defalias 'company-template-declare-template #[(beg end) "\305 \"\306\n\307 #\210\306\n\310\311#\210\306\n\312\313#\210\n\fB\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]) (defalias 'company-template-remove-template #[(templ) "\302\303\304\305\"\"\210\306 \"\307!\207" [templ company-template--buffer-templates mapc company-template-remove-field overlay-get company-template-fields delq delete-overlay] 5]) #@295 Add new field to template TEMPL spanning from BEG to END. When DISPLAY is non-nil, set the respective property on the overlay. Leave point at the end of the field. AFTER-CLEAR-FN is a function that can be used to apply custom behavior after deleting a field in `company-template-remove-field'. (defalias 'company-template-add-field #[(templ beg end &optional display after-clear-fn) "\204\306\300!\210 \307!V\203\310\311! #\210\312\n \"\313\314\"\315\f\316\317#\210\315\f\320\321#\210 \2038\315\f\305 #\210\315\f\322#\210\315\f\323\324#\210\203P\315\f\325#\210\315\f\326#\210\315\f\327\330#\210\f B\315\314 #*\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 (#$ . 4237)]) (defalias 'company-template-remove-field #[(ovl &optional clear) "\304!\2051\305!\203 \203\306!\307!|\210\310!\210\311\312\"\311\n\313\"\314 \"\315\n\313 #*\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]) #@48 Clean up all templates that don't contain POS. (defalias 'company-template-clean-up #[(&optional pos) "\305\206`!\n\306\211\205%\f@\211 >\204\307 !\210\fA\211\204\306+\207" [pos local-ovs company-template--buffer-templates templ --dolist-tail-- overlays-at nil company-template-remove-template] 3 (#$ . 5612)]) #@49 Called when a snippet input prompt is modified. (defalias 'company-template-insert-hook #[(ovl after-p &rest _ignore) "?\205 \302 \303\"\207" [after-p ovl company-template-remove-field t] 3 (#$ . 5942)]) (defalias 'company-template-post-command #[nil "\301 \210?\205 \302\303\304\305#\207" [company-template--buffer-templates company-template-clean-up remove-hook post-command-hook company-template-post-command t] 4]) (defalias 'company-template-c-like-templatify #[(call) "\306 ` GZ\307\n\"\310\211\311 p \312\216\313\314\311 !!\210\315\316\317\"\210\315\320\321\"\210\322\321\n\323#\203F\306 \324u\210`|\210\325 \210\324u\210\306 \322\326\n\323#\203b\306 !\324u\210\325 \210\310u\210\327 !\"\210)\330\331\332 \"\203p\324\224\324\225|\210\f\203|\fb\210\327 \"\210+\333 \334\"\203\212\335 !\202\220\336 !\210b-\207" [end call beg templ paren-open paren-close point-marker company-template-declare-template nil syntax-table #[nil "rq\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]) (defalias 'company-template--c-like-args #[(templ end) "`\303\304 \305#\205&\306`\"@\307U\203\310\n\311\225\312\313%\210\314\312w\210`\202)\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]) (defalias 'company-template-objc-templatify #[(selector) "\305 ` GZS\306\n\"\307\212\nb\210\3102W\311\312\313#\205V\314\315!\2030\316 `\317\225#\210\202H\316 `\320\321\f\"c\210`#\210`W\203E\322c\210\fT`Y\203\323\310\313\"\210\2020\210)\324 !,\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]) (provide 'company-template)