{"id":13711321,"url":"https://github.com/ocaml/tuareg","last_synced_at":"2025-05-15T18:09:43.355Z","repository":{"id":12905137,"uuid":"15582353","full_name":"ocaml/tuareg","owner":"ocaml","description":"Emacs OCaml mode","archived":false,"fork":false,"pushed_at":"2025-02-28T02:57:34.000Z","size":1394,"stargazers_count":373,"open_issues_count":37,"forks_count":80,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-31T22:22:55.469Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ocaml.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-02T11:41:38.000Z","updated_at":"2025-03-31T10:19:39.000Z","dependencies_parsed_at":"2025-03-17T20:11:34.516Z","dependency_job_id":"b930fa2d-ed14-4b13-8692-a3dc8af7016a","html_url":"https://github.com/ocaml/tuareg","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Ftuareg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Ftuareg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Ftuareg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Ftuareg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocaml","download_url":"https://codeload.github.com/ocaml/tuareg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744335,"owners_count":20988783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:01:06.932Z","updated_at":"2025-04-07T23:09:20.655Z","avatar_url":"https://github.com/ocaml.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp","IDEs and Editors","Developer Tools"],"sub_categories":["Graphics and Visualization"],"readme":"[![NonGNU ELPA](https://elpa.nongnu.org/nongnu/tuareg.svg)](https://elpa.nongnu.org/nongnu/tuareg.html)\n[![MELPA](https://melpa.org/packages/tuareg-badge.svg)](https://melpa.org/#/tuareg)\n[![DebianBadge](https://badges.debian.net/badges/debian/stable/elpa-tuareg/version.svg)](https://packages.debian.org/stable/elpa-tuareg)\n[![License GPL 3](https://img.shields.io/badge/license-GPL_3-green.svg)](COPYING)\n[![Build Status](https://github.com/ocaml/tuareg/workflows/test/badge.svg)](https://github.com/ocaml/tuareg/actions?query=workflow%3Atest)\n\nTuareg: an Emacs OCaml mode\n===========================\n\nThis archive contains files to help editing [OCaml](http://ocaml.org/)\ncode, to highlight important parts of the code, to run an OCaml\n[REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)\n(also called *toplevel*),\nand to run the OCaml debugger within Emacs.\n\nPackage Contents\n--------\n\n- `README.md`      — This file.\n- `HISTORY`        — Differences with previous versions.\n- `tuareg.el`      — A major mode for editing OCaml code in Emacs.\n- `ocamldebug.el`  — To run the OCaml debugger under Emacs.\n- `sample.ml`      — Sample file to check the indentation engine.\n- `compilation.txt` — To check the compilation regexp `tuareg--error-regexp`.\n\nInstall\n-------\n\nThe easier way to install Tuareg is though\nthe [Emacs package system](https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html)\nwith [NonGNU ELPA][] or\n[MELPA][] ([configuration](https://melpa.org/#/getting-started)).\n\nYou can also install it using [OPAM][]:\n\n    opam install tuareg\n\nand follow the instructions given at the end of the `opam`\ninstallation.\n\nIf you want to install from the Git checkout, just add to your\n[Init File][] the line:\n\n    (load \"path-to-git-checkout-dir/tuareg-site-file\")\n\nIf you want to byte compile the files, issue `make elc`.  If you do\nthis in Darwin, make sure that the version of Emacs displayed at the\nend of `make elc` is the sole that you use (the `.elc` files may not\nbe compatible with other versions of Emacs installed on your system).\n\n\nUsage \u0026 Configuration\n---------------------\n\nThe Tuareg major mode is triggered by visiting a file with extension\n`.ml`, `.mli`, and `.mlp` or manually by \u003ckbd\u003eM-x tuareg-mode\u003c/kbd\u003e.\nA [Menhir][] mode, `tuareg-menhir`, supports `.mly` files.  (A special\nmode for `.mll` has yet to be written.)\n\nFor the convenience of users of [ocsigen][], the extensions\n[`.eliom`](http://ocsigen.org/eliom/), `.eliomi` trigger `tuareg-mode`.\n\nStart the OCaml REPL with \u003ckbd\u003eM-x run-ocaml\u003c/kbd\u003e.\nTo evaluate a\nphrase, simply type \u003ckbd\u003eS-⟨return⟩\u003c/kbd\u003e (\u003ckbd\u003eshift\u003c/kbd\u003e and\n\u003ckbd\u003ereturn\u003c/kbd\u003e).  You can also evaluate a\nphrase in a different buffer by typing \u003ckbd\u003eC-c C-e\u003c/kbd\u003e when the\ncursor is on it (it\nwill start the OCaml REPL if needed).\n\nRun the OCaml debugger with \u003ckbd\u003eM-x ocamldebug FILE\u003c/kbd\u003e.\n\n\nTips \u0026 customization\n--------------------\n\n- You can comment/uncomment a single line with `tuareg-comment-dwim`\n  which is bound to \u003ckbd\u003eC-cC-;\u003c/kbd\u003e.\n\n- By default, Tuareg will align the arguments of functions as follows:\n\n        function_name arg1\n          arg2\n\n  This is what most OCaml programmers expect and is convenient if you\n  use the following style:\n\n        function_name (fun x -\u003e\n            do_something\n          )\n          arg2\n\n  If you prefer the “lisp style” indentation in which arguments on the\n  second line are aligned with the arguments on the first line as in\n\n        function_name arg1\n                      arg2\n\n  put `(setq tuareg-indent-align-with-first-arg t)` in your [Init File][].\n\n  In both cases, if there are no argument on the line following the\n  function name, the indentation will be:\n\n        function_name\n          arg1\n          arg2\n\n- To make easier to distinguish pattern-match cases containing several\n  patterns, sub-patterns are slightly indented as in\n\n        match x with\n        | A\n          | B -\u003e ...\n        | C -\u003e ...\n\n  If you prefer all pipes to be aligned as\n\n        match x with\n        | A\n        | B -\u003e ...\n        | C -\u003e ...\n\n  use `(setq tuareg-match-patterns-aligned t)`.\n\n- Emacs ≥ 24.4 turned on [electric-indent-mode][] mode by default.  If\n  you do not like it, call `(electric-indent-mode 0)` in\n  `tuareg-mode-hook`.\n\n  [electric-indent-mode]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Indent-Convenience.html\n\n- Tuareg respects you default commenting style.  However, in OCaml,\n  commenting a region is usually done with a single multi-line comment\n  and without leading stars on each line.  You can have that behavior\n  in OCaml buffers by setting:\n\n        (add-hook 'tuareg-mode-hook\n                  (lambda()\n                    (setq-local comment-style 'multi-line)\n                    (setq-local comment-continue \"   \")))\n\n- If you turn on `show-paren-mode`, the delimiters of comments will\n  also be highlighted.  If you do not like this behavior, set\n  `tuareg-comment-show-paren` to `nil`.\n\n- Syntax highlighting has 3 levels.  You can select the one you prefer\n  by setting [font-lock-maximum-decoration][] from `0` to `2`.  By\n  default, [font-lock-maximum-decoration][] is set to `t` which\n  means that the maximum level of decoration will be used.\n\n[font-lock-maximum-decoration]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html\n\n- Fontifying all operators (as opposed to only non-standard ones) is a\n  costly operation that slows down font-lock.  This is why it is\n  disabled by default.  If you nonetheless want it, set\n  `tuareg-highlight-all-operators` to `t` in your [Init File][]\n  (before `tuareg-mode` is initialized; in particular, not in a hook\n  added to `'tuareg-mode-hook`).\n\n- You can turn on and off the rendering of certain sequences of\n  characters as symbols (such as `∔` and `∧` instead of `+.`and `\u0026\u0026`),\n  use `prettify-symbols-mode` or use the check box in the _Tuareg\n  Options_ menu.  To enable it by default when you start Tuareg, add\n  the following to your [Init File][]:\n\n        (add-hook 'tuareg-mode-hook\n                  (lambda()\n                    (when (functionp 'prettify-symbols-mode)\n                      (prettify-symbols-mode))))\n\n  If you want more symbols to be prettified (such as `-\u003e` being\n  displayed as `→`) at the expense of modifying the indentation in\n  incompatible ways with those not using that option, add `(setq\n  tuareg-prettify-symbols-full t)` to your [Init File][].\n\n- By default, constructors are highlighted with the default face\n  because having too many colors is distracting.  If you wish to\n  customize the appearance of constructors, add to your [Init File][]\n  the following code adapted to your tastes.\n\n        (face-spec-set\n         'tuareg-font-lock-constructor-face\n         '((((class color) (background light)) (:foreground \"SaddleBrown\"))\n           (((class color) (background dark)) (:foreground \"burlywood1\"))))\n\n- To have a list of definitions in the buffer, use [imenu][].  It is\n  available by right clicking in the buffer.  You can also launch the\n  `speedbar` and click on file to have a list of definitions.\n\n[imenu]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html\n\n- If you wish to have a nice 🐫 as the mode name, add\n\n        (add-hook 'tuareg-mode-hook\n                  (lambda() (setq tuareg-mode-name \"🐫\")))\n\n  to your [Init File][].\n\nThanks to the work of Stefan Monnier, a new indentation engine based on\n[SMIE](https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html)\nwas written.  This changes the indentation somewhat w.r.t. the\nprevious versions of `tuareg`.  If the indentation does not correspond\nto what you expect, please submit a\n[motivated issue](https://github.com/ocaml/tuareg/issues/).\n\n\nThe standard Emacs customization tool can be used to configure Tuareg\noptions.  It is available from the Options menu and Tuareg's Customize\nsub-menu.  Note that, at the moment, both customization options\npertaining to the SMIE indentation mode and the old one are present.\n\nYou may also customize the appearance of OCaml code by twiddling the\nvariables listed at the start of tuareg.el (preferably using\n`tuareg-mode-hook`, you should not patch the file directly).\nYou should then add to your configuration file something like:\n\n    (add-hook 'tuareg-mode-hook\n      (lambda () ... ; your customization code ))\n\nFor example:\n\n    (add-hook 'tuareg-mode-hook\n              ;; Turn on auto-fill minor mode.\n              #'auto-fill-mode)\n\nSee [dot-emacs.el](dot-emacs.el) for some examples.\n\n[Init File]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html\n\nAdditional packages\n-------------------\n\n### Merlin\n\nIt is recommended to install [Merlin][] which is available in\n[OPAM][].  Tuareg will automatically detect it and use some of its\nfeatures (e.g. for *imenu*).  Merlin offers auto-completion, the\npossibility to query the type with \u003ckbd\u003eC-cC-t\u003c/kbd\u003e, to find the\nlocation of an identifier with \u003ckbd\u003eC-cC-l\u003c/kbd\u003e, to go to the next\n(resp. previous) phrase with \u003ckbd\u003eC-cC-n\u003c/kbd\u003e\n(resp. \u003ckbd\u003eC-cC-p\u003c/kbd\u003e),...  Highly recommended.\n\n### opam-switch-mode\n\nIf you happen to work with several switches, it is recommended to install\n[opam-switch-mode][] (available in [NonGNU ELPA][] and [MELPA][]).\nThis minor mode defines a command \u003ckbd\u003eM-x opam-switch-set-switch\u003c/kbd\u003e\nas well as a menu-bar and a mode-bar menu \"OPSW\",\nto easily select another OPAM switch. Upon such a change, a hook kills\nthe running OCaml toplevel, if any, so that the next eval command\nis run using the OCaml toplevel from the new switch.\n\n### Caml mode\n\n[caml-mode][] (available in [NonGNU ELPA][] and [MELPA][]) is used to\ndisplay types (using\nthe obsolete `*.annot` files), open a module for documentation,...\n\n[Menhir]: http://gallium.inria.fr/~fpottier/menhir/\n[ocsigen]: http://ocsigen.org/\n[Merlin]: https://github.com/ocaml/merlin\n[OPAM]: http://opam.ocaml.org/\n[caml-mode]: https://github.com/ocaml/caml-mode\n[NonGNU ELPA]: https://elpa.nongnu.org/\n[MELPA]: https://melpa.org/\n[opam-switch-mode]: https://github.com/ProofGeneral/opam-switch-mode\n\n\nReporting\n---------\n\nThe official Tuareg home page is located at:\n\u003chttps://github.com/ocaml/tuareg\u003e.\n\nBug reports \u0026 patches: use the tracker:\n\u003chttps://github.com/ocaml/tuareg/issues\u003e.\n\nThanks\n------\n\nIan Zimmerman for the previous mode, compilation interface and\ndebugger enhancement.\n\nJacques Garrigue enhanced Zimmerman's mode along with an adaptation\nto OCaml (and Labl) syntax. Although this work was performed\nindependently, his useful test file and comments were of great help.\n\nMichel Quercia for excellent suggestions, patches, and helpful\nemacs-lisp contributions (full, ready-to-work implementations, I\nshould say), especially for Tuareg interactive mode, and browser\ncapacities.\n\nDenis Barthou, Pierre Boulet, Jean-Christophe Filliatre and Rémi\nVanicat for intensive testing, useful suggestions, and help.\n\nRalf Treinen for maintaining the Debian GNU/Linux package.\n\nEvery people who sent me bug reports, suggestions, comments and\npatches. Nothing would have improved since version 0.9.2 without\ntheir help. Special thanks to Eli Barzilay, Josh Berdine, Christian\nBoos, Carsten Clasohm, Yann Coscoy, Prakash Countcham, Alvarado\nCuihtlauac, Erwan David, Gilles Défourneaux, Philippe Esperet,\nGilles Falcon, Tim Freeman, Alain Frisch, Christian Lindig, Claude\nMarché, Charles Martin, Dave Mason, Stefan Monnier, Toby Moth,\nJean-Yves Moyen, Alex Ott, Christopher Quinn, Ohad Rodeh, Rauli\nRuohonen, Hendrik Tews, Christophe Troestler, Joseph Sudish, Mattias\nWaldau and John Whitley.\n\nTuareg mode have been maintained by Albert Cohen until version 1.45.\n\nJane Street took over maintenance based on Albert Cohen's version 1.46\n(later retracted by him), and released its first version as 2.0.\n\nLicense\n-------\n\nTuareg is distributed under the GNU General Public License, version 3 or later.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focaml%2Ftuareg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focaml%2Ftuareg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focaml%2Ftuareg/lists"}