# ocamlspot

 camlspotter bdf1996 2012-06-19 camlspotter 2ae9a4f 2012-08-31 camlspotter bdf1996 2012-06-19 camlspotter 23764e8 2012-08-28 camlspotter bdf1996 2012-06-19 camlspotter 23764e8 2012-08-28 camlspotter fa90dfa 2012-07-24 camlspotter bf0060b 2012-08-23 camlspotter fa90dfa 2012-07-24 camlspotter 71a3296 2012-08-28 camlspotter 2e5711e 2012-12-03 camlspotter bf0060b 2012-08-23 camlspotter 6a6f6f5 2012-09-19 camlspotter 778b0e2 2013-01-24 camlspotter 19aceb3 2013-01-22 camlspotter 778b0e2 2013-01-24 camlspotter 19aceb3 2013-01-22 camlspotter 778b0e2 2013-01-24 camlspotter 19aceb3 2013-01-22 camlspotter 778b0e2 2013-01-24 camlspotter 19aceb3 2013-01-22 camlspotter 778b0e2 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter 778b0e2 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter 19aceb3 2013-01-22 camlspotter bf0060b 2012-08-23 camlspotter 778b0e2 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter 778b0e2 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter 778b0e2 2013-01-24 camlspotter bb3f594 2013-01-24 camlspotter 27d2e9d 2012-08-27 camlspotter 778b0e2 2013-01-24 camlspotter a0e11a9 2013-01-23 camlspotter bb3f594 2013-01-24 camlspotter a0e11a9 2013-01-23 camlspotter 27d2e9d 2012-08-27 camlspotter bf0060b 2012-08-23 camlspotter bb3f594 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter bb3f594 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter a0e11a9 2013-01-23 camlspotter 778b0e2 2013-01-24 camlspotter c44cff1 2012-08-31 camlspotter bb3f594 2013-01-24 camlspotter 778b0e2 2013-01-24 camlspotter 27d2e9d 2012-08-27 camlspotter a0e11a9 2013-01-23 camlspotter 27d2e9d 2012-08-27 camlspotter 778b0e2 2013-01-24 camlspotter bf0060b 2012-08-23 camlspotter bb3f594 2013-01-24 camlspotter c44cff1 2012-08-31 camlspotter 778b0e2 2013-01-24 camlspotter bb3f594 2013-01-24   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 ========================================== OCamlSpotter - OCaml source browsing ========================================== OCamlSpotter is a tool for OCaml source code browsing. * You can search the definitions of names of values, functions, data types and modules. * Emacs and Vim helpers help your browsing via editors. * Definition search traverses module aliases and functor applications: if module M = N, OCamlSpotter automatically seeks the definition of M.x in N. Very helpful in the modern OCaml programming with lots of modules. OCamlSpotter 2.x uses \*.cmt and \*.cmti files created by OCaml compiler 4.00.0 or newer with -bin-annot option. Unlike OCamlSpotter 1.x, OCamlSpotter 2.x is a standalone application. You NO LONGER need compiler patching. Just make, make install, and configure ocamlspot.el. Dependency ===================== OCamlSpotter strongly depends on OCaml compiler implementation and its compiler-libs library. You need use the correct pairs of compiler and OCamlSpotter. https://bitbucket.org/camlspotter/ocamlspot provides OCamlSpotter branches for each OCaml versions: * ocaml- : compilable against the given OCaml version * ocaml-4.00.0 : the latest "stable" version * ocaml-4.00.1 : the latest "stable" version * default : Development version. Sometimes not compilable. Not for you. Versions ================ OCamlSpotter is always under development and there is no clear release versions. If you want to use the latest stable version of OCamlSpotter, choose the tip of the branch with the name of your OCaml compiler version. When you report bugs, please note the revision hash with your issue description please. Installation ============================ To compile OCamlSpotter:: % make % make opt (This is optional but recommended) % make install Setup ============================ If you are Emacs user, see ocamlspot.el. It explains how to set up and use it. I have also written Vim script ocamlspot.vim, but it is not tested at all. Sorry but I do not use Vim. How to use =============================== Before using, it is better to know what to do if something goes wrong --------------------------------------------------------------------------- * Use the correct ocamlspot matching with your OCaml compiler version. * Compile OCaml modules with -bin-annot ocaml compiler option. * Keep the source code and produced cmt/cmti files. * Install cmt/cmti files along with cmi/cma/cmxa files. * Use ocamlspot.opt if you have done make opt. It is much faster than ocamlspot. * CamlP4 has lots of location issues. In many cases, OCamlSpotter cannot workaround them. * OCamlSpotter has its own bugs. Browsing your code ------------------------------------------------- Compile your OCaml source code with -bin-annot option, then it should create *.cmt and *.cmti files. Open the source code in your Emacs and move the cursor to an identifier usage, then type C-c ;. If things are properly installed and set up, Emacs should display the definition of the identifier. Browsing libraries and packages ---------------------------------------------- Normally OCaml libraries and packages are not always compiled with -bin-annot option and do not always install the annotation files. Therefore, if you want to use OCamlSpotter with installed libraries and packages, you must rebuild them with -bin-annot compiler option. This requires little modifications to their build script (Makefile/OMakefile/...). Basically, you need: * Add -bin-annot to the compiler switch. For example OCAMLCFLAGS += -bin-annot * Copy cmt and cmti files at installation. For example:: install:: cp *.mli *.cmi *.cma *.cmt *.cmti *.cmxa \$(INSTALLDIR) * Do not remove the original source files, otherwise browsing cannot work. Browsing OCaml stdlib and otherlibs --------------------------------------------------- If you want to browse OCaml's standard library (stdlib and otherlibs), you must recompile those modules with -bin-annot option to create cmt/cmti files. It should require some Makefile changes and reinstallation of the compiler. Automation ------------------------------------ Recompilation of libraries and compiler with fixing their build scripts is very lousy. To facilitate these you may want to use SpotInstall( https://bitbucket.org/camlspotter/spotinstall ). SpotInstall provides: * A small OCaml compiler patch to automatically enable -bin-annot by the existence of OCAML_ANNOT environment variable; no need to fix build scripts. * An automatic cmt/cmti post installation command, spotinstall. Even with SpotInstall, you have to still recompile the compiler and the libraries. But you do no longer need to fix the build scripts. Reporting bugs ============================== OCamlSpotter has bugs. I need your help to fix them. Please report your issues at https://bitbucket.org/camlspotter/ocamlspot/issues?status=new&status=open . * Please attach the smallest reproducible example as possible. * Explain which version of OCamlSpot you use. i.e. OPAM version or Repo fingerprint. * If your code is compiled with CamlP4 and ocamlspot shows you strange locations, probably it is due to CamlP4 location bugs. Check the P4-expanded version whether it is a bug of P4 or OCamlSpotter.