;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'caml-emacs) #@103 Path list for ocaml lib sources (mli files). `lazy' means ask ocaml to find it for you at first use. (defvar ocaml-lib-path 'lazy (#$ . 110)) #@58 Compute if necessary and return the path for ocaml libs. (defalias 'ocaml-lib-path #[nil "<\204,\303\304\305\301!\203(\306\307 \"\203(\310\311 \"\312P\313\n!\205$\n\314P)\206)\315!!\207" [ocaml-lib-path inferior-caml-program file split-string shell-command-to-string boundp string-match "\\([^ ]*/ocaml\\)\\( \\|$\\)" match-string 1 "c" file-executable-p " -where" "ocamlc -where"] 5 (#$ . 259)]) (defalias 'ocaml-capitalize #[(s) "\301\302\303O!\303\304OP\207" [s capitalize 0 1 nil] 4]) (defalias 'ocaml-uncapitalize #[(s) "G\301V\203\301\302O\227\302\303OP\207\207" [s 0 1 nil] 4]) (defalias 'ocaml-find-files #[(path filter &optional depth split) ";\203\306!\205\202\307\310\311#\211\205/\312 \313\n\314 \205'\315\316 !P\f?\205-\317\260\211\2057\320 !\f\203K;\203K\321\322\"\202M+\207" [path path-string filter depth split command file-directory-p mapconcat #[(d) "\301!\205\207" [d file-directory-p] 2] " " "find " " '(' " " ')' " " -maxdepth " int-to-string " -printf '%p '" shell-command-to-string split-string "\n" files] 9]) #@96 A-list of modules with how and where to find help information. `delay' means non computed yet. (defvar ocaml-module-alist 'lazy (#$ . 1348)) (defalias 'ocaml-add-mli-modules #[(modules tag &optional path) "\306\206\307 \310\311\312$\211:\203T\313\314 @\"\203M\315\316\311 @\"!\317 @!\211\307 \235\211:\203: \f@\230\203:\f@\320\n \"\204L\n B\321BB B+ A\211\202 )\207" [path files module dir dirp modules ocaml-find-files ocaml-lib-path "-type f -name '*.mli'" 1 t string-match "\\([^/]*\\).mli" ocaml-capitalize match-string file-name-directory assoc lazy tag] 6]) #@68 Extend `ocaml-module-alist' with modules of DIR relative to PATH. (defalias 'ocaml-add-path #[(dir &optional path) "\304 \306 !\203 \202\307\310\nB\"\206\311\312!\313 Q@ ABB\314\305 \315 #\211*\207" [old dir default-directory new ocaml-lib-path ocaml-module-alist file-name-absolute-p find-if #[(p) "\302\303 Q!\207" [p dir file-directory-p "/"] 4] error "Directory not found" "/" ocaml-add-mli-modules lib] 4 (#$ . 1937) "D"]) #@54 Call by need value of variable `ocaml-module-alist'. (defalias 'ocaml-module-alist #[nil "<\204\n\301\302\303\"\207" [ocaml-module-alist ocaml-add-mli-modules nil lib] 3 (#$ . 2386)]) (defalias 'ocaml-get-or-make-module #[(module &optional tag) "\304\303 \"\211\204\305\nB\306BB\211 B )\207" [module info default-directory ocaml-module-alist assoc local lazy] 4]) (defalias 'ocaml-module-filename #[(module) "\303!\304\305\306P\211!\2041\307 \n:\2030\n@\310\306R\305 !\203+\304\211\202\304\202) *\207" [module name tmp ocaml-uncapitalize nil file-exists-p ".mli" ocaml-lib-path "/"] 5]) (defalias 'ocaml-module-symbols #[(module-info) "@\205 A\211@@\n@A\306\211\nA<\203\"\nA\202\206 \307=\203,@\f\310\311 !\312R\313 !\210\314 \315\216\316\317!q\210 \203Y\320 !\203Y\313\321 \"\210\322 !\210\202^\313\323 \"\210\324\325d\326#\203{\327p!\210\330\331!\206s\330\332!B\202^\333 \210*\n\241\210.\207" [module-info module tail tag dir file nil info "/" ocaml-uncapitalize ".mli" message current-window-configuration #[nil "\301!\207" [#1=#:wconfig set-window-configuration] 2] get-buffer-create "*caml-help*" file-exists-p "Scanning module %s" insert-file-contents "Module %s not found" re-search-forward "\\([ ]*val\\|let\\|exception\\|external\\| [|]\\) \\([a-zA-Z_0-9'][a-zA-Z_0-9']*\\)\\|^ *[{]* \\([a-z_][A-Za-z_0-9]*\\) : [^;\n][^;\n]*;" move pop-to-buffer match-string 2 3 erase-buffer alist ocaml-lib-path #1#] 5]) #@46 A-list of open modules, local to every file. (defvar ocaml-visible-modules 'lazy (#$ . 3875)) (make-variable-buffer-local 'ocaml-visible-modules) (defalias 'ocaml-visible-modules #[nil "<\204,\302\303!C\212eb\210\304\305d\306#\203+\307\310!\311 \"\204'\302 !B)\202)\207" [ocaml-visible-modules module ocaml-get-or-make-module "Pervasives" re-search-forward "^ *open *\\([A-Z][a-zA-Z'_0-9]*\\)" t match-string 1 assoc] 4]) #@117 *Make module of name ARG visible when ARG is a string. When call interactively, make completion over known modules. (defalias 'ocaml-open-module #[(arg) ";\204\303 \304\305 \");\203,\306\232\204,\307\302 \"\203%\310!\210\311!\302 B\312\313\314\315\302 \"\"\207" [arg modules ocaml-visible-modules ocaml-module-alist completing-read "Open module: " "" assoc ocaml-close-module ocaml-get-or-make-module message "%S" mapcar car] 5 (#$ . -4317) "P"]) #@178 *Close module of name ARG when ARG is a string. When call interactively, make completion over visible modules. Otherwise if ARG is true, close all modules and reset to default. (defalias 'ocaml-close-module #[(arg) "\303!\304U\203 \305\2027\301 \211\204\306\307!\210;\2041\310\311\n@@\312Q\n\"\211\313\232\2031\n@@\314\315 \")\316\317\320\321\301 \"\"\207" [arg ocaml-visible-modules modules prefix-numeric-value 4 lazy error "No visible module to close" completing-read "Close module [" "] : " "" remove-if #[(m) "@ \232\207" [m arg] 2] message "%S" mapcar car] 6 (#$ . -4785) "P"]) #@421 Search for a qualified identifier (Path. entry) around point. Entry may be nil. Currently, the path may only be nil or a single Module. For paths is of the form Module.Path', it returns Module and always nil for entry. If defined Module and Entry are represented by a region in the buffer, and are nil otherwise. For debugging purposes, it returns the string Module.entry if called with an optional non-nil argument. (defalias 'ocaml-qualified-identifier #[(&optional show) "\212\303\211\304\305!\203\306\303x\210\307\310`\311Z\312#\203>\304\313!\204\"\314u\210\304\315!\2032\314\224\314\225B\316\225b\210\304\317!\203>\314\224\314\225B\n\203Y \205K @ A{\320\205U@A{Q\202\\ B+\207" [entry module show nil looking-at "[ \n]" " " re-search-backward "\\([^A-Za-z0-9_.']\\|\\`\\)\\([A-Za-z0-9_']*[.]\\)*[A-Za-z0-9_']*\\=" 100 t "\\`[A-Za-z)-9_.]" 1 "\\<\\([A-Za-z_][A-Za-z0-9_']*\\)[.]" 0 "\\<\\([A-Za-z_][A-Za-z0-9_']*\\)\\>" "."] 4 (#$ . 5390)]) (defalias 'ocaml-completion #[(pattern module) "\203\305\306 \"\206\307\310\"C\206\311 \312\313\314\315 \316#\"\210\n\204.\317\320\321\322 \"\"\202=\323\324\n!P\325\326\327 \"\210 *)\207" [module list pattern res pat assoc ocaml-module-alist error "Unknown module %s" ocaml-visible-modules message "Completion from %s" mapconcat car " " apply append mapcar ocaml-module-symbols "^" regexp-quote nil mapc #[(l) "\301\302\303!\"\207" [l mapc #[(x) "\304 @\"\205\n \235?\205\n B\211\207" [pat l x res string-match] 3] ocaml-module-symbols] 4]] 6]) #@398 Does completion for OCaml identifiers qualified. It attemps to recognize a qualified identifier Module . entry around point using function \[ocaml-qualified-identifier]. If Module is defined, it does completion for identifier in Module. If Module is undefined, it does completion in visible modules. Then, if completion fails, it does completion among all modules where identifier is defined. (defalias 'caml-complete #[(arg) "\306 \307\211\307\211\307@\203X@@@A{\310\n\311 \"\204X\312\313\311 \307\211\n%\211\203S\212@@b\210@@@A|\210\nc\210)\306 \211\203S@\203SA\202X\314\315\n\"\210A:\203iA@AA\202\n\203\212@Ab\210\316\317!)\203\320\225\211 \203\207\f\204\215\314\321!\202v \f{\322 \n\")\323 \324\325)\"\"\211*\326=\206u*\204)\327 !+\330+\331 \",\307-+\204\305\307\202\367+G\332=\203\324+@@\202\367,G\332=\203\343,@@\202\367\324\333+\"-\312\313+\307\326\334-\320B&\211\204\314\335 \"\202%\336\337\n\"\210:\203A:\203@@\f|\210\202  \f|\210\n\340 \261,\202u *\230\204= \f|\210 b\210*c\202u./r\341\342!q\210p\343 \210/.\307\21101\326\2112\32634\344 \210\345\346!\210+\21156\347)!\3505!\210+*.\207" [module-entry entry module beg end pattern ocaml-qualified-identifier nil assoc ocaml-module-alist completing-read "Module: " error "Unknown module %s" looking-at " *[.]" 0 "Did not find anything to complete around point" ocaml-completion try-completion mapcar list t ocaml-find-module intersection ocaml-visible-modules 1 car "" "Can't find completion for \"%s\"" message "Completion found in module %s" "." get-buffer-create "*Completions*" kill-all-local-variables erase-buffer run-hooks temp-buffer-setup-hook display-completion-list internal-temp-output-buffer-show all-completions completion modules visible hist default-directory #1=#:old-dir buffer-read-only buffer-file-name buffer-undo-list inhibit-modification-hooks inhibit-read-only #2=#:buf standard-output] 9 (#$ . 6928) "p"]) #@163 Prefix of ocaml info files describing library modules. Suffix .info will be added to info files. Additional suffix .gz may be added if info files are compressed. (defvar ocaml-info-prefix "ocaml-lib" (#$ . 8928)) (defalias 'ocaml-hevea-info-add-entries #[(entries dir name) "\306\307Q\310\311 \"\312\f\203\f;\203\313\f\314\"\203*\315\316\317\320\f\321#\"\210\202\221\315\322\f\"\210\323 (\324\216\325\326!q\210\327\f\330\n\331\260\315\332 \"\210\333 p\"\204R\334\335!\210eb\210\336\nd\337#\203\202\340\341!)\340\342!*\343)+\"\204~)\344\345*RB+B+*\202U\346\326!\211,\203\220\347,!\210++,\207" [name filter section-regexp dir files command "-type f -regex '.*/" "\\(.info\\|\\)\\(-[0-9]*\\|\\)\\([.]gz\\|\\)'" "\\* \\(Section [1-9][0-9--]*\\)::[ ][ ]*Module *\\([A-Z][A-Za-z_0-9]*\\)" ocaml-find-files nil string-match "^ *$" message "No info file found: %s." mapconcat identity " " "Scanning info files %s." current-window-configuration #[nil "\301!\207" [#1=#:wconfig set-window-configuration] 2] get-buffer-create "*caml-help*" "zcat -f " " | grep -e '" "'" "Scanning files with: %s" shell-command error "Error while scanning" re-search-forward t match-string 2 1 assoc "(" ")" get-buffer kill-buffer #1# module section entries buf] 7]) #@194 The default way to create an info data base from the value of \[Info-default-directory-list] and the base name \[ocaml-info-name] of files to look for. This uses info files produced by HeVeA. (defalias 'ocaml-hevea-info #[nil "\303\211\304\305\n\"\210 *\207" [seen collect Info-directory-list nil mapc #[(d) " \235?\205\304\n # B\211\207" [d seen collect ocaml-info-prefix ocaml-hevea-info-add-entries] 4]] 3 (#$ . 10208)]) (defalias 'ocaml-ocamldoc-info-add-entries #[(entries dir name) "\306\307 \310\n\311\312\260\313\314 \"\210\315 \316\216\317\320!q\210\321 p\"\204'\322\323 \"\210eb\210\324d\325#\203V\326\225f\327=\203*\330\326!\331 \"\204R \332\n\333 RBB)\202***\207" [module-regexp dir name command #1=#:wconfig module "^Node: \\([A-Z][A-Za-z_0-9]*\\)[^ ]" "find " " -type f -regex '.*/" "\\(.info\\|\\)\\([.]gz\\|\\)' -print0 | xargs -0 zcat -f | grep '" "'" message "Scanning info files in %s" current-window-configuration #[nil "\301!\207" [#1# set-window-configuration] 2] get-buffer-create "*caml-help*" shell-command error "Could not run:%s" re-search-forward t 1 127 match-string assoc "(" ")" entries] 7]) #@197 The default way to create an info data base from the value of \[Info-default-directory-list] and the base name \[ocaml-info-name] of files to look for. This uses info files produced by ocamldoc. (defalias 'ocaml-ocamldoc-info #[nil "\303\304!\210\305\211\306\307\n\"\210 *\207" [seen collect Info-directory-list require info nil mapc #[(d) " \235?\205\304\n # B\211\207" [d seen collect ocaml-info-prefix ocaml-ocamldoc-info-add-entries] 4]] 3 (#$ . 11369)]) #@580 A-list binding module names to info entries: nil means do not use info. A function to build the list lazily (at the first call). The result of the function call will be assign permanently to this variable for future uses. We provide two default functions `ocaml-hevea-info' (info produced by HeVeA is the default) and `ocaml-ocamldoc-info' (info produced by ocamldoc). Otherwise, this value should be an alist binding module names to info entries of the form to "(entry)section" be taken by the \[info] command. An entry may be an info module or a complete file name. (defvar ocaml-info-alist 'ocaml-ocamldoc-info (#$ . 11845)) #@52 Call by need value of variable `ocaml-info-alist'. (defalias 'ocaml-info-alist #[nil "<\204\301!\203 \202\302\303!\210\207" [ocaml-info-alist functionp error "wrong type for ocaml-info-alist"] 2 (#$ . 12490)]) (defalias 'ocaml-find-module #[(symbol &optional module-list) "\206\304 \305\211:\203# \306\n@!\235\203\n@ B\nA\211\202\n \237*\207" [module-list collect list symbol ocaml-module-alist nil ocaml-module-symbols] 4]) (defalias 'ocaml-buffer-substring #[(region) "\205\n\301@A\"\207" [region buffer-substring-no-properties] 3]) #@175 Search info manual for MODULE and ENTRY in MODULE. If unspecified, MODULE and ENTRY are inferred from the position in the current buffer using \[ocaml-qualified-identifier]. (defalias 'ocaml-goto-help #[(&optional module entry same-window) "\306 \307\310 \" \203\311 A!\210\202n\312 \210\307\313 \"\206-\314\315!\316P!\205-\317!\211A@A\211\203]\f\315!\316Q\320%!\203Q\321%!\210\322&'\"\210\323 !\210\324p!\210)\202m \203h\325\326!\210\202m\325\327\"\210*(;\203\300`\330(!\331)*+eb\210\332\333*Pd\334#\204\255\332\335*\336Qd\334#\204\255\320\n!\203\244\321\n!\210\325\337(#\203\264\340\341!\210\202\277\342\343(#\210+b\210+\344 A!\210\320\n!\205\316\321\n!*\207" [module info-section window module-info location file selected-window assoc ocaml-info-alist caml-info-other-window ocaml-visible-modules ocaml-module-alist file-exists-p ocaml-uncapitalize ".mli" ocaml-get-or-make-module window-live-p select-window view-mode-exit view-file-other-window bury-buffer error "Aborted" "No help for module %s" regexp-quote nil re-search-forward "\\(val\\|exception\\|type\\|external\\|[|{;]\\) +" t "type [^{]*{[^}]*" " :" "Entry %s not found in module %s" ocaml-help-show -1 message "Help for entry %s not found in module %s" ocaml-link-activate same-window view-return-to-alist view-exit-action entry case-fold-search regex here] 5 (#$ . 13058) nil]) (custom-declare-face 'ocaml-help-face '((t :background "#88FF44")) "Face to highlight expressions and types.") (defvar ocaml-help-ovl (byte-code "\301\302\211\"\303\304\305#\210)\207" [ovl make-overlay 1 overlay-put face ocaml-help-face] 4)) #@938 Find documentation for OCaml qualified identifiers. It attempts to recognize a qualified identifier of the form ``Module . entry'' around point using function `ocaml-qualified-identifier'. If Module is undetermined it is temptatively guessed from the identifier name and according to visible modules. If this is still unsuccessful, the user is then prompted for a Module name. The documentation for Module is first searched in the info manual, if available, then in the ``module.mli'' source file. The entry is then searched in the documentation. Visible modules are computed only once, at the first call. Modules can be made visible explicitly with `ocaml-open-module' and hidden with `ocaml-close-module'. Prefix arg 0 forces recompilation of visible modules (and their content) from the file content. Prefix arg 4 prompts for Module and identifier instead of guessing values from the position of point in the current buffer. (defalias 'caml-help #[(arg) "\306!\210\307\211\211\f\310U\203L\311\312\313 \307\314\315\316\317B&\211\203' \315\230\203+\320\321!\210\322\323\324\325 \313 \"!\"\311\326\327 \" \307\314$)\n\315\230\203\302\307\202\302\f\317U\203U\330\331 \332 A!\332 @!\206\301\333\n\334 \"\206o\333\n!\307\211&\211'\204\202\320\335\n\"\202\300'G\336=\203\221'@@\202\300\322\337'\"\211@&\311\312&\205\250\340&\341QP'\307\314\315\316\317B&\211\315\230\203\277&\202\300 +\342\343 \n\203\315\344\202\316\315\n\206\323\315$\210\345 \n\"+\207" [ocaml-help-ovl module-entry entry module arg symbols delete-overlay nil 4 completing-read "Module: " ocaml-module-alist t "" hist 0 error "Quit" mapcar list ocaml-module-symbols assoc format "Value: %s." lazy ocaml-qualified-identifier ocaml-buffer-substring ocaml-find-module ocaml-visible-modules "No module found for entry %s" 1 car "[" "] " message "Help for %s%s%s" "." ocaml-goto-help default modules] 9 (#$ . 14699) "p"]) (defconst ocaml-link-regexp "\\(type\\|and\\) \\('[a-z] +\\|(\\('[a-z], *\\)*'[a-z])\\|\\) *\\([a-zA-Z0-9_]*\\)\\( *$\\| =\\)") (defconst ocaml-longident-regexp "\\([A-Z][a-zA-Z_0]*\\)[.]\\([a-zA-Z][A-Za-z0-9_]*\\)") #@291 Local links in the current of last info node or interface file. The car of the list is a key that identifies the module to prevent recompilation when next help command is relative to the same module. The cdr is a list of elements, each of which is a string and a pair of buffer positions. (defvar ocaml-links nil (#$ . 16860)) (make-variable-buffer-local 'ocaml-links) (defalias 'ocaml-info-links #[(section) "\203 \203@ \232\203\202D\212eb\210\n\306=\203!\307\202\"\310 P\311\312 d\313#\203>\314\315!\315\224\315\225BB\fB\202' \fB\211+A\207" [ocaml-links section major-mode ocaml-link-regexp all regexp Info-mode "^ - " "^" nil re-search-forward t match-string 4] 4]) (defvar ocaml-link-map (byte-code "\301 \302\303\304#\210)\207" [map make-sparse-keymap define-key [mouse-2] ocaml-link-goto] 4)) (defalias 'ocaml-help-show #[(arg) "`v\210`\211b\210\304 \np$\210\305\306!*\207" [arg left right ocaml-help-ovl move-overlay recenter 1] 6]) #@23 Follow link at point. (defalias 'ocaml-link-goto #[(click) "\306!\307!\310\n!\311 \312r q\210\313 T\314 \315Z$\316 \314 \315\\${)\317\320\321Q \"\203B\322\323\324 \"\323\325 \"\n#\202k\310\f! \232\204N\326 !\210\327 A\"\211\203b A@b\210\330\324!\210\331\f!\205k\332\f!-\207" [click pos win buf window link caml-event-point-start caml-event-window window-buffer selected-window nil previous-single-property-change local-map 100 next-single-property-change string-match "^" "$" ocaml-goto-help match-string 1 2 switch-to-buffer-other-window assoc ocaml-help-show window-live-p select-window ocaml-longident-regexp ocaml-links] 7 (#$ . 17832) "e"]) (custom-declare-face 'ocaml-link-face '((((class color)) :foreground "Purple")) "Face to highlight hyperlinks.") (defalias 'ocaml-link-activate #[(section) "\306!\211\205T\307\n\310\311\312 \310#\313\260\314\212eb\210\314\315 \316\216\212eb\210\317\fd\320#\205R\321\322\224\322\225\323\324$\210\321\322\224\322\225\325$\210\326 \203&\321\322\224\322\225\327\330$\210\202&.)\207" [section links ocaml-longident-regexp case-fold-search regexp modified-p ocaml-info-links "[^A-Za-z0-9'_]\\(" "\\|" mapconcat car "\\)[^A-Za-z0-9'_]" nil buffer-modified-p #[nil "?\205\301\302!\207" [modified-p set-buffer-modified-p nil] 2] re-search-forward t put-text-property 1 mouse-face highlight local-map x-display-color-p face ocaml-link-face buffer-read-only ocaml-link-map] 8]) (provide 'caml-help)