;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\207" [require ivy subr-x cl-lib erlang imenu counsel simple async thingatpt xref] 2) (defconst ivy-erlang-complete--base (file-name-directory load-file-name)) (byte-code "\300\301\302\303#\210\304\305\306\307\310DD\311\312\313\314\301&\207" [custom-declare-group ivy-erlang-complete nil "`ivy-erlang-complete' - context sensitive erlang completion and more with `ivy' frontend." custom-declare-variable ivy-erlang-complete-erlang-root funcall function #[0 "\300\207" [#1="/usr/lib/erlang/"] 1 #1#] "Path to erlang root." :type string :group] 8) #@30 Path to erlang project root. (defvar ivy-erlang-complete-project-root nil (#$ . 772)) #@51 Regular expression for erlang files (*.erl *.hrl) (defvar ivy-erlang-complete--file-suffix "-U -G '\\.[eh]rl'" (#$ . 864)) (make-variable-buffer-local 'ivy-erlang-complete--file-suffix) #@28 Candidates for completion. (defvar ivy-erlang-complete-candidates nil (#$ . 1056)) (make-variable-buffer-local 'ivy-erlang-complete-candidates) #@23 Completion predicate. (defvar ivy-erlang-complete-predicate nil (#$ . 1206)) (make-variable-buffer-local 'ivy-erlang-complete-predicate) #@39 Records accessible in current buffer. (defvar ivy-erlang-complete-records nil (#$ . 1349)) (make-variable-buffer-local 'ivy-erlang-complete-records) #@38 Macros accessible in current buffer. (defvar ivy-erlang-complete-macros nil (#$ . 1504)) (make-variable-buffer-local 'ivy-erlang-complete-macros) #@44 Record names accessible in current buffer. (defvar ivy-erlang-complete--record-names nil (#$ . 1656)) (make-variable-buffer-local 'ivy-erlang-complete--record-names) #@36 Local functions in current buffer. (defvar ivy-erlang-complete--local-functions nil (#$ . 1828)) (make-variable-buffer-local 'ivy-erlang-complete--local-functions) #@24 Current erlang record. (defvar ivy-erlang-complete--record nil (#$ . 1998)) (make-variable-buffer-local 'ivy-erlang-complete--record) #@46 Local variables for current cursor position. (defvar ivy-erlang-complete--local-vars nil (#$ . 2138)) (make-variable-buffer-local 'ivy-erlang-complete--local-vars) (defvar ivy-erlang-complete--comment-regexp "%.*$") #@42 Sync variable for async records parsing. (defvar ivy-erlang-complete--record-parsing-in-progress nil (#$ . 2360)) (make-variable-buffer-local 'ivy-erlang-complete--record-parsing-in-progress) #@41 Sync variable for async macros parsing. (defvar ivy-erlang-complete--macros-parsing-in-progress nil (#$ . 2558)) (make-variable-buffer-local 'ivy-erlang-complete--macros-parsing-in-progress) #@28 Memoizaton for behaviours. (defvar ivy-erlang-complete--behaviours (make-hash-table :test 'equal) (#$ . 2755)) #@24 Memoizaton for eldocs. (defvar ivy-erlang-complete--eldocs nil (#$ . 2872)) (make-variable-buffer-local 'ivy-erlang-complete--eldocs) #@46 Global variable for use with async commands. (defvar ivy-erlang-complete--global-project-root nil (#$ . 3012)) (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\210\300\312\302\303\313DD\314\306\307\310\311&\210\300\315\302\303\316DD\317\306\307\310\311&\210\300\320\302\303\321DD\322\306\307\310\311&\210\300\323\302\303\324DD\325\306\307\310\311&\210\300\326\302\303\327DD\330\306\307\310\311&\210\300\331\302\303\332DD\333\306\334\310\311&\207" [custom-declare-variable ivy-erlang-complete--setup-flycheck funcall function #[0 "\300\207" [t] 1] "Enable automatic setup flycheck." :type boolean :group ivy-erlang-complete ivy-erlang-complete-use-default-keys #[0 "\300\207" [t] 1] "Enable default keybindings in init." ivy-erlang-complete-enable-eldoc #[0 "\300\207" [t] 1] "Enable eldoc." ivy-erlang-complete-enable-autosave #[0 "\300\207" [t] 1] "Enable autosave. If this option is set, buffer will be saved before try to get eldoc asynchronously." ivy-erlang-complete-enable-fun-head-eldoc #[0 "\300\207" [t] 1] "Enable function head as eldoc if no specs or callbacks at point." ivy-erlang-complete-enable-notification #[0 "\300\207" [nil] 1] "Enable notification on updated completions." ivy-erlang-complete-ignore-dirs #[0 "\300\207" [(".git" "_build")] 1] "Exclude directory patterns from this list while search definition/references." list] 8) #@46 Notify about updated completions if enabled. (defalias 'ivy-erlang-complete--notify #[0 "\205\301\302!\207" [ivy-erlang-complete-enable-notification message "Erlang completions updated"] 2 (#$ . 4385)]) #@49 Return path to executable with NAME. (fn NAME) (defalias 'ivy-erlang-complete--executable #[257 "\301Q\207" [ivy-erlang-complete--base "bin/"] 4 (#$ . 4597)]) (byte-code "\300\301!\203 \302\303\304\"\210\300\207" [featurep flycheck defalias ivy-erlang-complete-setup-flycheck #[257 "\303\301!\210\304\305\306\307\310\311 \312\260!!\211\313P\314P\315\316\"\317P\315\316\"\320P\257\"\305\306\307\321\311 \322\260!!\303\302!\210\211\211\207" [default-directory flycheck-erlang-include-path flycheck-erlang-library-path make-local-variable append split-string shell-command-to-string "find " "/* " ivy-erlang-complete--filter-find " -type d -name include -print" "/include" "/deps" locate-dominating-file "src" "include" "deps" " " " -type d -name ebin -print"] 11 "Setup flycheck for use correct paths for erlang PROJECT-ROOT with deps.\n\n(fn PROJECT-ROOT)"]] 3) #@42 Automatically setup erlang project root. (defalias 'ivy-erlang-complete-autosetup-project-root #[0 "\203\207\302\300!\210\303  \203\304\305!\203\306!\210\207" [ivy-erlang-complete-project-root ivy-erlang-complete--setup-flycheck make-local-variable ivy-erlang-complete--find-root-by-deps featurep flycheck ivy-erlang-complete-setup-flycheck] 2 (#$ . 5480) nil]) #@104 Find project root as directory with rebar dependencies start from START-DIR. (fn &optional START-DIR) (defalias 'ivy-erlang-complete--find-root-by-deps #[256 "\301\302\303\"\206 \304\"\211\2031\302\305\306\307\310\311!#!\"\312!\203-\313!\203-\302!\2060\314!\207\302\2067!\207" [default-directory locate-dominating-file expand-file-name ".." "rebar.config" shell-command-to-string format "cd %s && %s" ivy-erlang-complete--executable "find-deps-dir" file-exists-p directory-files ivy-erlang-complete--find-root-by-deps] 9 (#$ . 5860)]) #@40 Config ivy-erlang-complete by default. (defalias 'ivy-erlang-complete-init #[0 "\305 \210\306\300!\210\307\310\311\"\312 \210 \203C\313\n\314\315#\210\313\n\316\317#\210\313\n\320\321#\210\313\n\322\323#\210\313\n\324\325#\210\313\n\326\327#\210\313\n\330\331#\210\313\n\332\333#\210 \205N\306\304!\210\334\211\207" [ivy-erlang-complete--eldocs ivy-erlang-complete-use-default-keys erlang-mode-map ivy-erlang-complete-enable-eldoc eldoc-documentation-function ivy-erlang-complete-autosetup-project-root make-local-variable make-hash-table :test equal ivy-erlang-complete-reparse define-key [67108922] ivy-erlang-complete "" ivy-erlang-complete-show-doc-at-point "" ivy-erlang-complete-set-project-root [134217774] ivy-erlang-complete-find-definition [134217791] ivy-erlang-complete-find-references "" ivy-erlang-complete-find-spec [134217772] xref-pop-marker-stack "" ivy-erlang-complete-find-file ivy-erlang-complete-eldoc] 4 (#$ . 6418) nil]) #@46 Show doc for function from standart library. (defalias 'ivy-erlang-complete-show-doc-at-point #[0 "\301 \302\303\304\305#)\266\203\204\306\307\"\207\310\302\"\211@A@\311 \312\313\314\"\315!\"\2043\306\316!\207\317\320\321\304\322\204C \202P \302\n\323\324\325 \"\260\326\327&\207" [inhibit-changing-match-data ivy-erlang-complete-thing-at-point ":" nil t string-match message "Can't find docs for %s." split-string erlang-get-function-arity cl-mapcar make-closure #[257 "\300\301Q\207" [V0 ":"] 4 "\n\n(fn S)"] ivy-erlang-complete--find-functions "module at point not found" ivy-read "Counsel-erl cand:" :require-match :initial-input "/" format "%d" :action #[257 "\300\301\"\302\303\304@A@\3058$!\207" [split-string "[:/]" browse-url format "http://erlang.org/doc/man/%s.html#%s-%s" 2] 9 "\n\n(fn S)"]] 19 (#$ . 7381) nil]) (defvar ivy-erlang-complete--export-regexp "-export([[:space:]\n]*\\[[\n[:space:]]*[a-z/0-9\n[:space:],_]*][\n[:space:]]*).") (defvar ivy-erlang-complete--last-erlang-comment nil nil) (make-variable-buffer-local 'ivy-erlang-complete--last-erlang-comment) #@56 Copy current buffer to new one with removing comments. (defalias 'ivy-erlang-complete--copy-buffer-no-comments #[0 "\302 \303\303Q\304ed\"`\305!\203\306!\210r\307!q\210c\210eb\210\310 \311#\2036\312\313\314\315!G\316\"!\210\202!\211b\210)\207" [ivy-erlang-complete--comment-regexp ivy-erlang-complete--last-erlang-comment buffer-name "*" buffer-substring-no-properties buffer-live-p kill-buffer get-buffer-create search-forward-regexp t replace-match make-string match-string 0 32] 8 (#$ . 8498)]) #@40 Find functions in MODULE. (fn MODULE) (defalias 'ivy-erlang-complete--find-functions #[257 "\204\302 \210\303\304\305\306! F\307\310\311#\266\202!\312\"\207" [ivy-erlang-complete-project-root ivy-erlang-complete-erlang-root ivy-erlang-complete-set-project-root split-string shell-command-to-string ivy-erlang-complete--executable "exported-funcs.sh" " " mapconcat identity "\n"] 9 (#$ . 9013)]) #@40 Find functions in MODULE. (fn MODULE) (defalias 'ivy-erlang-complete--exported-types #[257 "\204\302 \210\303\304\305\306! F\307\310\311#\266\202!\312\"\207" [ivy-erlang-complete-project-root ivy-erlang-complete-erlang-root ivy-erlang-complete-set-project-root split-string shell-command-to-string ivy-erlang-complete--executable "exported-types.sh" " " mapconcat identity "\n"] 9 (#$ . 9422)]) #@15 Find modules. (defalias 'ivy-erlang-complete--find-modules #[0 "\204\302 \210\303\304\305\306\307 \310 \311\312\257\313\314\315#\266\202!\316\"\"\207" [ivy-erlang-complete-project-root ivy-erlang-complete-erlang-root ivy-erlang-complete-set-project-root cl-mapcar #[257 "\211\300P\207" [":"] 3 "\n\n(fn S)"] split-string shell-command-to-string "find" ivy-erlang-complete--filter-find "-iname '*.erl' -print | xargs basename -a |" "sed -E -e 's/\\.erl//g'" " " mapconcat identity "\n"] 10 (#$ . 9831)]) #@43 Extract all records from FILE. (fn FILE) (defalias 'ivy-erlang-complete--extract-records #[257 "\204\301 \210\302\303\304\305\306\307\310 \311 \312\313\314\315\316\317\320\257 \307\321\322#\266\202!\323\"\"\207" [ivy-erlang-complete-project-root ivy-erlang-complete-set-project-root cl-mapcar #[257 "\211\300P\207" [")."] 3 "\n\n(fn S)"] split-string shell-command-to-string "find" " " ivy-erlang-complete--filter-find " -name" "-print" "|" "xargs" "sed" "-E" "-n" "'/-record\\(/,/}\\)./p'" mapconcat identity ")\\."] 18 (#$ . 10347)]) #@67 Parse RECORD and set it acessable in current buffer. (fn RECORD) (defalias 'ivy-erlang-complete--parse-record #[257 "\301\302\303\304!\305\306R!!\3071\310@A#0\207\210\311\207" [ivy-erlang-complete-records read shell-command-to-string ivy-erlang-complete--executable "parse-record" " \"\"\"" "\"\"\"" (error) puthash nil] 7 (#$ . 10897)]) #@27 Find all local functions. (defalias 'ivy-erlang-complete--find-local-functions #[0 "\204`\3021\303 0\210\202\210\211b\266\304\305 \"\207" [ivy-erlang-complete--local-functions imenu--index-alist (error) imenu--make-index-alist cl-mapcar #[257 "\211@\207" [] 2 "\n\n(fn ELEM)"]] 3 (#$ . 11248)]) #@32 Find local variables at point. (defalias 'ivy-erlang-complete--find-local-vars #[0 "`\302v\210`\303\304\305\306#\211\203\307\"\202\310b\210\311\312\313\314\306\"r\211q\210\315\316\"\216c\210eb\210\305\317\301!\210\305\320\321\305\306#\203U\322\323!\211 \235\203M \266\2026\211 B\210\2026 *\262\"\207" [case-fold-search ivy-erlang-complete--local-vars -1 search-backward-regexp "^[a-z]" nil t buffer-substring-no-properties "" cl-remove-if #[257 "\301P\235\207" [ivy-erlang-complete-macros "?"] 3 "\n\n(fn S)"] generate-new-buffer " *temp*" make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] make-local-variable search-forward-regexp "[A-Z][A-Za-z_0-9]*" match-string 0] 11 (#$ . 11559)]) #@60 Return the erlang thing at point, or nil if none is found. (defalias 'ivy-erlang-complete-thing-at-point #[0 "\300\301!\205 \302\303!\207" [thing-at-point-looking-at "??#?['A-Za-z0-9_:]*" match-string-no-properties 0] 2 (#$ . 12302)]) #@61 Return the erlang record at point, or nil if none is found. (defalias 'ivy-erlang-complete-record-at-point #[0 "\301\302\303\"\304\"\205 \305\306!\207" [erlang-atom-regexp thing-at-point-looking-at format "#\\(%s\\)\\([ -]*{[^{^}^#]*}?\\)*[.]*" 500 match-string-no-properties 0] 4 (#$ . 12544)]) #@61 Return the erlang export at point, or nil if none is found. (defalias 'ivy-erlang-complete-export-at-point #[0 "r\301\302 !q\210\303\304\"\205\305\306!\307 \210\211\262)\207" [ivy-erlang-complete--export-regexp get-buffer-create ivy-erlang-complete--copy-buffer-no-comments thing-at-point-looking-at 500 match-string-no-properties 0 kill-buffer] 3 (#$ . 12848)]) #@28 Return t if type at point. (defalias 'ivy-erlang-complete--is-type-at-point #[0 "\212`\301\211\302 \210`W\203\303`#\262\202 \211@@@\304\230)\266\203)\207" [case-fold-search nil erlang-beginning-of-clause erlang-partial-parse "::"] 7 (#$ . 13221)]) #@29 Return t if guard at point. (defalias 'ivy-erlang-complete--is-guard-at-point #[0 "\212`\301\211\302 \210`W\203\303`#\262\202 \211@@@\304\230)\266\203)\207" [case-fold-search nil erlang-beginning-of-clause erlang-partial-parse "when"] 7 (#$ . 13484)]) #@40 Get included files for current buffer. (defalias 'ivy-erlang-complete--get-included-files #[0 "\300\301\302\303\304d\"\305 \306\307\"\216\310\311\312#\203'\313\304\"B\262\310\225\262\202\262)\262\266\202\"\207" [cl-mapcar #[257 "\300!\207" [file-name-nondirectory] 3 "\n\n(fn M)"] "-include[_lib]*([:space:]*\"\\([^\"]+\\)" buffer-substring-no-properties 1 match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] 0 nil string-match match-string] 11 (#$ . 13751)]) #@61 Reparse macros and recors for completion in current buffer. (defalias 'ivy-erlang-complete-reparse #[0 "\303\230\205\304\305 \210\306 \210\307\302!\210\310\311\312\"\313 \207" [major-mode ivy-erlang-complete--local-functions ivy-erlang-complete--behaviours "erlang-mode" nil ivy-erlang-complete--find-local-functions ivy-erlang-complete--async-parse-macros make-local-variable make-hash-table :test equal ivy-erlang-complete--async-parse-records] 3 (#$ . 14261) nil]) #@31 Parse erlang records in FILE. (defalias 'ivy-erlang-complete--parse-records #[0 "\301\300!\210\302\303\304\"\305\306\307\305\310\311\312 \313\314 !C\"\"!\"\210\207" [ivy-erlang-complete-records make-local-variable make-hash-table :test equal cl-mapcar ivy-erlang-complete--parse-record ivy-erlang-complete--flatten ivy-erlang-complete--extract-records append ivy-erlang-complete--get-included-files file-name-nondirectory buffer-file-name] 9 (#$ . 14740)]) #@44 Flatten tree X into a single list. (fn X) (defalias 'ivy-erlang-complete--flatten #[257 "\300C\211\301\302\"\240\210\211\242\300\"\207" [nil make-closure #[514 "\301\204\207:\204B\207@\262\300\242A\"\262\266\202" [V0 nil] 8 "\n\n(fn X ACC)"]] 6 (#$ . 15205)]) #@48 Async parse erlang records for current buffer. (defalias 'ivy-erlang-complete--async-parse-records #[0 "?\2052\302\303\304\305\306\307!\306\310!\306\311!\312\313\314 D\315\301 E\316BBBBBBBB\304\317\320\321 \322BB\323BBB\"\207" [ivy-erlang-complete--record-parsing-in-progress ivy-erlang-complete-project-root t async-start lambda nil async-inject-variables "load-path" "ivy-erlang-complete-project-root" "ivy-erlang-complete-erlang-root" (require 'ivy-erlang-complete) find-file buffer-file-name setq ((setq eval-expression-print-length nil) (setq print-length nil) (prin1-to-string (ivy-erlang-complete--parse-records))) (res) with-current-buffer buffer-name ((setq ivy-erlang-complete-records (read res)) (setq ivy-erlang-complete--record-parsing-in-progress nil)) ((ivy-erlang-complete--notify))] 11 (#$ . 15492)]) #@41 Return list of acceptable record names. (defalias 'ivy-erlang-complete--get-record-names #[0 "\204 \302 \210\303\304!\210\305\207\305\306\307\"\210 \207" [ivy-erlang-complete-records ivy-erlang-complete--record-names ivy-erlang-complete-reparse message "Please wait for record parsing" nil maphash #[514 "\301PB\211\207" [ivy-erlang-complete--record-names "#"] 4 "\n\n(fn KEY _)"]] 3 (#$ . 16319)]) #@44 Return list of RECORD fields. (fn RECORD) (defalias 'ivy-erlang-complete--get-record-fields #[257 "\204 \301 \210\302\303!\210\304\207\305\306\307\"\"\207" [ivy-erlang-complete-records ivy-erlang-complete-reparse message "Please wait for record parsing" nil cl-mapcar #[257 "\211@A\205 \300\301A!\302\303\304#\266\202P\305\306G\307$\210\211\262P\207" [" :: " ivy-erlang-complete--flatten " | " mapconcat identity set-text-properties 0 (face success)] 9 "\n\n(fn S)"] gethash] 6 (#$ . 16731)]) #@45 Extract erlang macros from FILE. (fn FILE) (defalias 'ivy-erlang-complete--extract-macros #[257 "\301\302\303\304\305\306\307\310 \311\n\312\257\313\314\315#\266\202!!\316\"\"!\207" [ivy-erlang-complete-project-root cl-delete-duplicates cl-mapcar #[257 "\300\301\211\302\303\"\203\211G\304O\266\202\202\262\305\"@\306\"@P\207" ["?" split-string "-define(" string-prefix-p nil "," "("] 9 "\n\n(fn S)"] split-string string-trim shell-command-to-string "find" ivy-erlang-complete--filter-find "-name" " -print | xargs grep -h -e '^-define('" " " mapconcat identity "\n"] 13 (#$ . 17244)]) #@42 Return list of acceptable erlang macros. (defalias 'ivy-erlang-complete--get-macros #[0 "\204$\301\302\303\304\305\306\307\310\257\311\312\303\313 \314\315 !\316\317\315 !QC\"\"\"!!\207" [ivy-erlang-complete-macros cl-delete-duplicates ivy-erlang-complete--flatten append "?MODULE" "?MODULE_STRING" "?FILE" "?LINE" "?MACHINE" cl-mapcar ivy-erlang-complete--extract-macros ivy-erlang-complete--get-included-files file-name-base buffer-file-name "." file-name-extension] 12 (#$ . 17851)]) #@47 Async parse erlang macros for current buffer. (defalias 'ivy-erlang-complete--async-parse-macros #[0 "?\2052\302\303\304\305\306\307!\306\310!\306\311!\312\313\314 D\315\301 E\316BBBBBBBB\304\317\320\321 \322BB\323BBB\"\207" [ivy-erlang-complete--macros-parsing-in-progress ivy-erlang-complete-project-root t async-start lambda nil async-inject-variables "load-path" "ivy-erlang-complete-project-root" "ivy-erlang-complete-erlang-root" (require 'ivy-erlang-complete) find-file buffer-file-name setq ((setq eval-expression-print-length nil) (setq print-length nil) (prin1-to-string (ivy-erlang-complete--get-macros))) (res) with-current-buffer buffer-name ((setq ivy-erlang-complete-macros (read res)) (setq ivy-erlang-complete--macros-parsing-in-progress nil)) ((ivy-erlang-complete--notify))] 11 (#$ . 18349)]) #@31 Set root for current project. (defalias 'ivy-erlang-complete-set-project-root #[0 "\302\303\304\"!\211\207" [default-directory ivy-erlang-complete-project-root expand-file-name read-directory-name "Select project directory:"] 4 (#$ . 19170) nil]) #@44 Insert CANDIDATE at point. (fn CANDIDATE) (defalias 'ivy-erlang-complete--insert-candidate #[257 "\300\301\"\203\302\303\"\304\302\305\"!\210\306!\207\307 \203\310!\207\311\312\"\203D\313\314!\203D\310\312\311\"\203@\211G\315O\266\202\202B\262!\207\300\316\"\203r\317\303\224\303\225O!\310\320\321\322#\323\324\325U\203e\202gS\326\"\327R!\210`Zb\207\300\330\"\203\206\331 \203\206\310!\210`Sb\207\310!\207" [string-match "\\(.*\\) \\(::.*\\)" match-string-no-properties 2 ivy-erlang-complete--insert-candidate 1 message ivy-erlang-complete-export-at-point ivy-completion-in-region-action string-prefix-p "?" thing-at-point-looking-at "?['A-Za-z0-9_:]+" nil "\\([^/]+\\)/\\([0-9]+\\)" string-to-number replace-regexp-in-string "/[0-9]+" "" "(" make-string 0 44 ")" ".*()$" ivy-erlang-complete--is-guard-at-point] 8 (#$ . 19425)]) #@48 Return formated exported functions with arity. (defalias 'ivy-erlang-complete--get-export #[0 "\300\301\302 \"\207" [cl-mapcar #[257 "\300\301@A#\207" [format "%s/%d"] 5 "\n\n(fn X)"] erlang-get-export] 3 (#$ . 20296)]) #@29 Erlang completion at point. (defalias 'ivy-erlang-complete #[0 "\306 \211\203>\307\310\"\203>\211\311\224\311\225O\312 \203\313!\202!\314!\211\315P\316\"\2037\211G\317O\266\202\2029\262\210\202\234\320 \203N\317\321\322\323 \"\202\234\324 \203^\325\326\327 \"\f\"\202\234\330 \203|\325\331\332\311\224\311\225\"!\333 \323 \334 \335 \336 &\202\234\312 \203\217\325\326\337 \"\340 \335 #\202\234\325\333 \323 \334 \335 \336 %\341\315\317\342+\307#)\266\203\203\262 \202\263\316\"\203\304\211G\317O\266\202\202\306\262\210\343 \344 \"\203\330\345\224,\345\225-\346\347\350 \351\352&\207" [ivy-erlang-complete-candidates ivy-erlang-complete-predicate ivy-erlang-complete--local-functions erlang-guards erlang-operators erlang-predefined-types ivy-erlang-complete-thing-at-point string-match "#?\\([^:]+\\):\\([^:]*\\)" 1 ivy-erlang-complete--is-type-at-point ivy-erlang-complete--exported-types ivy-erlang-complete--find-functions ":" string-prefix-p nil ivy-erlang-complete-export-at-point cl-remove-if #[257 "\211\300 \235\207" [ivy-erlang-complete--get-export] 3 "\n\n(fn EL)"] ivy-erlang-complete--find-local-functions ivy-erlang-complete--is-guard-at-point append cl-mapcar #[257 "\300\301\"\207" [format "%s()"] 4 "\n\n(fn G)"] ivy-erlang-complete-record-at-point ivy-erlang-complete--get-record-fields buffer-substring-no-properties ivy-erlang-complete--find-local-vars ivy-erlang-complete--get-record-names ivy-erlang-complete--find-modules ivy-erlang-complete--get-macros #[257 "\211\300P\207" ["()"] 3 "\n\n(fn S)"] ivy-erlang-complete--get-defined-types "?" t looking-back line-beginning-position 0 ivy-read "erlang cand:" :initial-input :action ivy-erlang-complete--insert-candidate inhibit-changing-match-data ivy-completion-beg ivy-completion-end] 9 (#$ . 20524) nil]) #@56 Search THING definition in DIRECTORY-PATH. (fn THING) (defalias 'ivy-erlang-complete--find-definition #[257 "\303\304\305\306#)\266\203\203#\307\303\"\211@A@\310\311P\312\313Q\"\207\314\315\"\203M\310\316\317 \320\321 !C\"\322\315\314\"\203H\211G\304O\266\202\202J\262P\"\207\323 \211\203f\310\316\317 \320\321 !C\"\324\325\326!\327Q\"\207\330\331!\203v\310\332\333\325\326!\334Q\"\207\335 \203\225\211\n\235\203\205\336\337!\207\310\316\317 \320\321 !C\"\340\313Q\"\207\341\304\305\306#)\266\203\203\260\310\320\321 !\312\313Q\"\207\336\342!\207" [inhibit-changing-match-data ivy-erlang-complete--record erlang-predefined-types ":" nil t string-match split-string ivy-erlang-complete--find-def ".erl" "^" "(" string-prefix-p "?" append ivy-erlang-complete--get-included-files file-name-nondirectory buffer-file-name "^-define(" ivy-erlang-complete-record-at-point "^-record(" match-string-no-properties 1 "," thing-at-point-looking-at "-behaviour(\\([a-z_]+\\))." ".erl$" "^-module(" ")." ivy-erlang-complete--is-type-at-point message "predefined type" "^-type " "^[a-z]" "Can't find definition"] 9 (#$ . 22363)]) #@77 Prepare ARGS for `ivy-erlang-complete--find-grep-spec-function'. (fn ARGS) (defalias 'ivy-erlang-complete--prepare-find-args #[257 "\211<\204\n\300C!\207\301\302\303!\"\304\305\306#\207" [ivy-erlang-complete--prepare-find-args cl-mapcar #[257 "\300\301\"\207" [format "-name '%s\\.erl'"] 4 "\n\n(fn S)"] ivy-erlang-complete--flatten " -o " mapconcat identity] 7 (#$ . 23517)]) #@77 Prepare ARGS for `ivy-erlang-complete--find-grep-spec-function'. (fn ARGS) (defalias 'ivy-erlang-complete--prepare-def-find-args #[257 "\211<\204\n\300C!\207\301\302\303!\"\304\305\306#\207" [ivy-erlang-complete--prepare-def-find-args cl-mapcar #[257 "\300\301\"\207" [format "-name '%s'"] 4 "\n\n(fn S)"] ivy-erlang-complete--flatten " -print -o " mapconcat identity] 7 (#$ . 23907)]) #@121 Grep in the project directory for STRING. If non-nil, EXTRA-ARGS string is appended to command. (fn STRING EXTRA-ARGS) (defalias 'ivy-erlang-complete--find-grep-spec-function #[514 "\211\204 \304\305!\210\306\262\211<\204\211C\262G\307W\203\310 \207\311\312\313!\211!!\314 \203P\315\316\317\320 \"\321\322\323#\266\202\317\324\"\321\322\323#\266\202\211\n &\202_\315\325\n \326 \327!\211&\330!\266\331\207" [ivy--old-re ivy-erlang-complete-ignore-dirs ivy-erlang-complete-erlang-root ivy-erlang-complete--global-project-root make-local-variable extra-args "*" 3 counsel-more-chars shell-quote-argument counsel--elisp-to-pcre ivy--regex ivy-erlang-complete-rg-installed\? format "rg -i --no-heading --line-number --max-columns 150 -uu -t erlang %s %s -e '^-callback %s\\(' -e '^-spec %s\\(' %s %s" cl-mapcar #[257 "\300\301\"\207" [format "-g '!%s'"] 4 "\n\n(fn S)"] " " mapconcat identity #[257 "\300\301\"\207" [format "-g '%s.erl'"] 4 "\n\n(fn S)"] "find %s %s %s %s -print | xargs grep -H -n -e '^-callback %s(' -e '^-spec %s('" ivy-erlang-complete--filter-find ivy-erlang-complete--prepare-find-args counsel--async-command nil] 12 (#$ . 24307)]) (byte-code "\300\301\302\"\210\303\301\304\305#\210\303\301\306\305#\210\307\301\310\"\207" [ivy-set-display-transformer ivy-erlang-complete--find-grep-spec-function counsel-git-grep-transformer counsel-set-async-exit-code 123 "No matches found" 1 ivy-set-occur counsel-ag-occur] 4) #@41 Exclude ignored dirs from find command. (defalias 'ivy-erlang-complete--filter-find #[0 "\301\302\"\303\304\305#\207" [ivy-erlang-complete-ignore-dirs cl-mapcar #[257 "\300\301\"\207" [format "-path '*/%s' -prune -o"] 4 "\n\n(fn DIR)"] " " mapconcat identity] 6 (#$ . 25776)]) #@71 Grep in the project directory for STRING in FILES. (fn STRING FILES) (defalias 'ivy-erlang-complete--find-grep-def-function #[514 "\211\204 \303\304!\210\305\262\211<\204\211C\262G\306W\203\307 \207\310 \203d\311\312\313\314\"\315\316\317#\266\202\313\320\"\315\316\317#\266\202\321\322\323#\321\322\323\324\n\325\"\203Z\211G\326O\266\202\202\\\262# \n&\202\210\311\327 \n\330 \331!\324 \325\"\203\204\211G\326O\266\202\202\206\262&\332!\266\326\207" [ivy-erlang-complete-ignore-dirs ivy-erlang-complete-erlang-root ivy-erlang-complete--global-project-root make-local-variable files "*" 3 counsel-more-chars ivy-erlang-complete-rg-installed\? format "rg -i --no-heading --line-number --max-columns 150 -uu -t erlang %s %s -e '%s' -e '-type %s' %s %s" cl-mapcar #[257 "\300\301\"\207" [format "-g '!%s'"] 4 "\n\n(fn S)"] " " mapconcat identity #[257 "\300\301\"\207" [format "-g '%s'"] 4 "\n\n(fn S)"] replace-regexp-in-string "(" "\\\\(" "^" string-prefix-p nil "find %s %s %s %s -print | xargs grep -H -n -e \"\"\"%s\"\"\" -e \"\"\"-type %s\"\"\"" ivy-erlang-complete--filter-find ivy-erlang-complete--prepare-def-find-args counsel--async-command] 15 (#$ . 26063)]) #@68 Return types that declared in current file and included libraries. (defalias 'ivy-erlang-complete--get-defined-types #[0 "\300\301\302\303 !C\304 \"!\207" [ivy-erlang-complete--find-grep-types-function append file-name-nondirectory buffer-file-name ivy-erlang-complete--get-included-files] 4 (#$ . 27279)]) #@71 Grep in the project directory for types defined in FILES. (fn FILES) (defalias 'ivy-erlang-complete--find-grep-types-function #[257 "\302\303 \304 \305!%\306\307!\310\"\207" [ivy-erlang-complete-erlang-root ivy-erlang-complete-project-root format "find %s %s %s %s -print | xargs grep -H -n -e '-type' | sed -E 's/::*//' | awk '{print $2}'" ivy-erlang-complete--filter-find ivy-erlang-complete--prepare-def-find-args split-string shell-command-to-string "\n"] 8 (#$ . 27592)]) (byte-code "\300\301\302\"\210\303\301\304\305#\210\303\301\306\305#\210\307\310\311\"\207" [ivy-set-display-transformer ivy-erlang-complete--find-grep-def-function counsel-git-grep-transformer counsel-set-async-exit-code 123 "No matches found" 1 ivy-set-occur ivy-erlang-complete--find-def-spec-function counsel-ag-occur] 4) #@60 Find definition in FILENAME by REGEX. (fn FILENAME REGEX) (defalias 'ivy-erlang-complete--find-def #[514 "\302\303\304\305\"\306\307\310\311\312\313\314\315\316&\f\207" [ivy-erlang-complete-project-root ivy-erlang-complete--global-project-root ivy-read "find definition " make-closure #[257 "\301\300\"\207" [V0 ivy-erlang-complete--find-grep-def-function] 4 "\n\n(fn STRING)"] :initial-input :dynamic-collection t :action counsel-git-grep-action :unwind #[0 "\300 \210\301 \207" [counsel-delete-process swiper--cleanup] 1] :caller ivy-erlang-complete--find-grep-def-function] 15 (#$ . 28406)]) #@36 Return FILE behaviours. (fn FILE) (defalias 'ivy-erlang-complete--extract-behaviours #[257 "\301\302#\206\303\304\305\306\307\310\311\"!\312\313#\"#\207" [ivy-erlang-complete--behaviours gethash nil puthash cl-mapcar #[257 "\300\301\"\210\302\303\"\207" [string-match "-behaviour(\\([^.]+\\))." match-string 1] 4 "\n\n(fn S)"] split-string shell-command-to-string format "grep -e '^-behaviour(' %s" "\n" t] 10 (#$ . 29014)]) #@36 Search spec for THING. (fn THING) (defalias 'ivy-erlang-complete--find-spec #[257 "\303\304\305\306#)\266\203\203.\307\303\"\211@A@\310\311\312\313\"\314\315\305\316\317\320\321\322\323&\f\207\324 \310\311\312\325\"\314\315\305\316\317\320\326\322\323&\f\207" [ivy-erlang-complete-project-root ivy-erlang-complete--global-project-root inhibit-changing-match-data ":" nil t string-match split-string ivy-read "find spec " make-closure #[257 "\301\300\"\207" [V0 ivy-erlang-complete--find-grep-spec-function] 4 "\n\n(fn STRING)"] :initial-input :dynamic-collection :action counsel-git-grep-action :unwind #[0 "\300 \210\301 \207" [counsel-delete-process swiper--cleanup] 1] :caller ivy-erlang-complete--find-grep-spec-function buffer-file-name #[257 "\301\302\303\300!\304\300!C\"\"\207" [V0 ivy-erlang-complete--find-grep-spec-function append ivy-erlang-complete--extract-behaviours file-name-base] 7 "\n\n(fn STRING)"] #[0 "\300 \210\301 \207" [counsel-delete-process swiper--cleanup] 1]] 17 (#$ . 29456)]) #@56 Find spec at point. It also find callback definition. (defalias 'ivy-erlang-complete-find-spec #[0 "\300 \210\301\302 !\207" [xref-push-marker-stack ivy-erlang-complete--find-spec ivy-erlang-complete-thing-at-point] 2 (#$ . 30487) nil]) #@25 Find erlang definition. (defalias 'ivy-erlang-complete-find-definition #[0 "\300 \210\301 \302!\207" [xref-push-marker-stack ivy-erlang-complete-thing-at-point ivy-erlang-complete--find-definition] 3 (#$ . 30731) nil]) (defvar ivy-erlang-complete--rg-installed\? 'unset) #@30 Return t if rg is installed. (defalias 'ivy-erlang-complete-rg-installed\? #[0 "\302=\203\303\304\305!\306\307\310#)\266\203??\211\207\207" [ivy-erlang-complete--rg-installed\? inhibit-changing-match-data unset "ripgrep" shell-command-to-string "rg --version" nil t string-match] 7 (#$ . 31009)]) #@57 Find THING references in project directory. (fn THING) (defalias 'ivy-erlang-complete--find-references #[257 "\303 \203\304\305\306\307\310 \"\311\312\313#\266\202\"\314$\207\315\305\316\n\317 \320\312\313#\266\202P#\314$\207" [ivy-erlang-complete-project-root ivy-erlang-complete-ignore-dirs ivy-erlang-complete--file-suffix ivy-erlang-complete-rg-installed\? counsel-rg format "-t erlang -uu %s" cl-mapcar #[257 "\300\301\"\207" [format "-g '!%s'"] 4 "\n\n(fn S)"] " " mapconcat identity "find references" counsel-ag "%s %s" "--ignore " " --ignore "] 14 (#$ . 31321)]) #@25 Find erlang references. (defalias 'ivy-erlang-complete-find-references #[0 "\302 \210\303 \304\305\306\307#)\266\203\203\310\311P!\207\312\313\"\203*\310\314\313\315#!\207\316\317!\2038\310\320\321\322!P!\207\316\323!\203F\310\315\321\322!P!\207\324 \203S\310\320\321\322!P!\207\316\325!\203a\310\326\321\327!P!\207`\330 b\210\331\326\311Qd\306\322$\206{\332\326\311Qe\306\322$b\210\262\203\216\310\333\334 !\304\311R!\207\335\336\337\"\340\333\334 !!\"\203\250\310\333\334 !\304\311R!\207\341\334 !\342\230\203\302\316\343\344 \"!\203\302\310\321\322!\311P!\207\310!\207" [inhibit-changing-match-data erlang-atom-regexp xref-push-marker-stack ivy-erlang-complete-thing-at-point ":" nil t string-match ivy-erlang-complete--find-references "(" string-prefix-p "?" replace-regexp-in-string "\\?" thing-at-point-looking-at "-record(\\(['A-Za-z0-9_:.]+\\)," "#" match-string-no-properties 1 "-define(\\(['A-Za-z0-9_:.]+\\)," ivy-erlang-complete-record-at-point "-behaviour(\\([a-z_]+\\))." "^" 0 line-beginning-position search-forward-regexp search-backward-regexp file-name-base buffer-file-name cl-find-if make-closure #[257 "\302\303\300\"\304\305\306#)\207" [V0 inhibit-changing-match-data format "%s/[0-9]+" nil t string-match] 8 "\n\n(fn X)"] ivy-erlang-complete--exported-types file-name-extension "hrl" format "^-type[ \n]+\\(%s\\)"] 8 (#$ . 31910) nil]) #@31 Find file in current project. (defalias 'ivy-erlang-complete-find-file #[0 "\301 \210\302\303\304\305\306!\203\307\310!\206\311 \206\312\"\"\207" [ivy-erlang-complete-project-root xref-push-marker-stack counsel-file-jump format "%s" thing-at-point-looking-at "\"\\([^\n]+\\)\"" match-string-no-properties 1 symbol-at-point ""] 5 (#$ . 33309) nil]) #@35 Function for async support eldoc. (defalias 'ivy-erlang-complete-eldoc #[0 "`\3021\f\303 0\210\202 \210\304 \305u\210\306 \307\310#\311\"b\210\204&\305\207\211\312\230\203.\305\207\211\305=\203s\313\312#\210 \203A\314 \210\315\316\305\317\320!\317\321!\317\322!\323\324\325 D\326\327\330`D\331BBBBBBBBBB\316\332\333\334 \313\335BBEE\"\210\305\207\336\337 \"\207" [ivy-erlang-complete--eldocs ivy-erlang-complete-enable-autosave (error) backward-up-list ivy-erlang-complete-thing-at-point nil erlang-get-arity format "%s/%s" gethash "in-progress" puthash save-buffer async-start lambda async-inject-variables "load-path" "ivy-erlang-complete-project-root" "ivy-erlang-complete-erlang-root" (require 'ivy-erlang-complete) find-file buffer-file-name (setq eval-expression-print-length nil) (setq print-length nil) goto-char ((ivy-erlang-complete--eldoc)) (res) with-current-buffer buffer-name (res ivy-erlang-complete--eldocs) ivy-erlang-complete--highlight-nth-arg ivy-erlang-complete--cur-arg-num] 17 (#$ . 33670)]) #@29 Function for support eldoc. (defalias 'ivy-erlang-complete--eldoc #[0 "`\3031\f\304 0\210\202 \210\305 \306u\210\307 \310\311\"\203]\312\313\"\312\314\"\315\316\317\320\321\322\323 \324   &!\325\"\"\"\206X\n\205X\315\316\326\320\321\322\327 \324   &!\330\"\"\"\266\202\202\343\331\332 !\203\264\315\316\333\320\321\322\334 \324 \335\331\332 !!\f&!\325\"\"\"\206\343\315\316\336\320\321\322\337\340\332 !#!\325\"\"\"\206\343\n\205\343\315\316\341\320\321\322\342\340\332 !#!\330\"\"\"\202\343\315\316\343\320\321\322\337\340\332 !#!\325\"\"\"\206\343\n\205\343\315\316\344\320\321\322\342\340\332 !#!\330\"\"\"b\210\211;\203\361\211\345\230\204\362\207\346\207" [ivy-erlang-complete-project-root ivy-erlang-complete-erlang-root ivy-erlang-complete-enable-fun-head-eldoc (error) backward-up-list ivy-erlang-complete-thing-at-point nil erlang-get-arity string-match "#?\\([^:]+\\):\\([^:]*\\)" match-string-no-properties 1 2 ivy-erlang-complete--match-by-arity cl-mapcar #[257 "\300!\301P\207" [string-trim "."] 3 "\n\n(fn S)"] split-string shell-command-to-string format "find %s %s %s -name '%s.erl' -print | xargs awk '/^-spec %s\\(/,/\\.$/'" ivy-erlang-complete--filter-find "\\.$" #[257 "\300!\207" [string-trim] 3 "\n\n(fn S)"] "find %s %s %s -name '%s.erl' -print | xargs awk '/^%s\\(/,/->/' | sed -E 's/->.*$/->/'" "->" ivy-erlang-complete--extract-behaviours buffer-file-name #[257 "\300!\301P\207" [string-trim "."] 3 "\n\n(fn S)"] "find %s %s %s %s -print | xargs awk '/^-callback %s\\(/,/\\.$/'" ivy-erlang-complete--prepare-find-args #[257 "\300!\301P\207" [string-trim "."] 3 "\n\n(fn S)"] "awk '/^-spec %s\\(/,/\\.$/' '%s'" expand-file-name #[257 "\300!\207" [string-trim] 3 "\n\n(fn S)"] "awk '/^%s\\(/,/->/' '%s' | sed -E 's/->.*$/->/'" #[257 "\300!\301P\207" [string-trim "."] 3 "\n\n(fn S)"] #[257 "\300!\207" [string-trim] 3 "\n\n(fn S)"] "." ""] 17 (#$ . 34708)]) #@67 Return first element from LIST matched by ARITY. (fn LIST ARITY) (defalias 'ivy-erlang-complete--match-by-arity #[514 "\300\301\302\"\"\207" [cl-find-if make-closure #[257 "\301\302\303\"r\211q\210\304\305\"\216c\210\306b\210\300\307\310!\232*\207" [V0 generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] 0 erlang-get-arity-after-regexp "[^(]*("] 5 "\n\n(fn EL)"]] 6 (#$ . 36648)]) #@74 Return the number of current argument in argument list at point, or nil. (defalias 'ivy-erlang-complete--cur-arg-num #[0 "\3001\232`\301\302\3031\304 0\210\202\210\305u\210\211\203\204m\203'\306\262\306\262\202`V\2033\306\262\202\307\310!\203?\306\262\202\307\311!\203K\305y\210\202\307\312!\203b\301U\203[T\262\301\225b\210\202\307\313!\203sT\262\301\225b\210\202\301U\203}T\262\314\305!\210\202b\210\306f\315=\203\225S\266\203\202\230\266\2030\207\210\306\207" [(error) 0 t (error) backward-up-list 1 nil looking-at "\\s *)" "\\s *\\($\\|%\\)" "\\s *<<[^>]*?>>" "\\s *," forward-sexp 44] 5 (#$ . 37101)]) #@44 Highlight Nth argument in EXP. (fn N EXP) (defalias 'ivy-erlang-complete--highlight-nth-arg #[514 "\300U\204\n\211\204 \207\301\302\303\"r\211q\210\304\305\"\216c\210\300b\210\306\307\310\303#\210\303\310\211\311=\2030`\262\312 \210\203\232m\203A\310\262\2023\204Q\311=\203Q`\262\2023\300=\203]\310\262\2023\313\314!\203i\310\262\2023\313\315!\203u\311y\210\2023\313\316!\203\202\300\225b\210\2023\313\317!\203\223S\262\300\225b\210\2023\312\311!\210\2023`\262\203\247\320\321#\210\266ed{*\207" [0 generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] search-forward-regexp "[^(]*(" nil 1 forward-sexp looking-at "\\s *)" "\\s *\\($\\|%\\)" "\\s *<<[^>]*?>>" "\\s *," add-text-properties (face eldoc-highlight-function-argument)] 10 (#$ . 37760)]) (provide 'ivy-erlang-complete)