{"id":15061025,"url":"https://github.com/ocaml/caml-mode","last_synced_at":"2025-10-25T14:16:22.120Z","repository":{"id":38373736,"uuid":"160386770","full_name":"ocaml/caml-mode","owner":"ocaml","description":"Emacs mode to edit OCaml files","archived":false,"fork":false,"pushed_at":"2023-10-11T03:30:13.000Z","size":318,"stargazers_count":19,"open_issues_count":3,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-30T06:24:01.079Z","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.itz","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}},"created_at":"2018-12-04T16:26:52.000Z","updated_at":"2024-05-04T13:54:23.000Z","dependencies_parsed_at":"2023-10-11T05:47:56.575Z","dependency_job_id":null,"html_url":"https://github.com/ocaml/caml-mode","commit_stats":{"total_commits":230,"total_committers":26,"mean_commits":8.846153846153847,"dds":0.7043478260869565,"last_synced_commit":"959a5a27bfdbaa43a9ff99be136d62e0798f5e01"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Fcaml-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Fcaml-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Fcaml-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocaml%2Fcaml-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocaml","download_url":"https://codeload.github.com/ocaml/caml-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869288,"owners_count":16555577,"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-09-24T23:08:24.040Z","updated_at":"2025-10-25T14:16:17.074Z","avatar_url":"https://github.com/ocaml.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"DESCRIPTION:\n\nThis directory contains files to help editing OCaml code, running a\nOCaml toplevel, and running the OCaml debugger under the Gnu Emacs editor.\n\nAUTHORS:\n\nIan T Zimmerman \u003citz@rahul.net\u003e added indentation to caml mode, beefed\nup camldebug to work much like gud/gdb.\n\nXavier Leroy (Xavier.Leroy@inria.fr), Jerome Vouillon (Jerome.Vouillon@ens.fr).\ncamldebug.el is derived from FSF code.\n\nCONTENTS:\n\n    caml.el         A major mode for editing OCaml code in Gnu Emacs\n    inf-caml.el     To run a OCaml toplevel under Emacs, with input and\n                    output in an Emacs buffer.\n    camldebug.el    To run the OCaml debugger under Emacs.\n\n\nNOTE FOR EMACS 18 USERS:\n\nThis package will no longer work with Emacs 18.x. Sorry. You really\nshould consider upgrading to Emacs 19.\n\nUSAGE:\n\nAdd the following lines to your .emacs file:\n\n(setq auto-mode-alist (cons '(\"\\\\.ml[iylp]?\" . caml-mode) auto-mode-alist))\n(autoload 'caml-mode \"caml\" \"Major mode for editing OCaml code.\" t)\n(autoload 'run-caml \"inf-caml\" \"Run an inferior OCaml process.\" t)\n(autoload 'camldebug \"camldebug\" \"Run the OCaml debugger.\" t)\n\nThe Caml major mode is triggered by visiting a file with extension .ml,\n.mli, .mly. .mll or .mlp, or manually by M-x caml-mode. It gives you the\ncorrect syntax table for the OCaml language. For a brief description of\nthe indentation capabilities, see below under NEWS.\n\nThe Caml mode also allows you to run batch Caml compilations from\nEmacs (using M-x compile) and browse the errors (C-x `). Typing C-x `\nsets the point at the beginning of the erroneous program fragment, and\nthe mark at the end. Under Emacs 19, the program fragment is\ntemporarily highlighted.\n\nM-x run-caml starts an OCaml toplevel with input and output in an Emacs\nbuffer named *inferior-caml*. This gives you the full power of Emacs\nto edit the input to the OCaml toplevel. This mode is based on comint\nso you get all the usual comint features, including command history.\n\nAfter M-x run-caml, typing C-c C-e or M-C-x in a buffer in Caml mode\nsends the current phrase (containing the point) to the OCaml toplevel,\nand evaluates it.\n\nM-x camldebug FILE starts the OCaml debugger camldebug on the executable\nFILE, with input and output in an Emacs buffer named *camldebug-FILE*.\nFor a brief description of the commands available in this buffer, see\nNEWS below.\n\nNEWS:\n\nOk, so this is the really important part of this file :-) I took the\noriginal package from the contrib subdirectory of the caml-light\ndistribution, and hacked on it. First, I added real syntax dependent\nindentation to caml mode. Like Xavier has said, it was hard (and I\nknew it would be), but I refused to believe it was impossible, partly\nbecause I knew of a Standard ML mode with indentation (written by\nMatthew Morley).\n\nIndentation works pretty much like in other programming modes. C-j at\nthe end of a line starts a new line properly indented. M-C-\\ indents\nthe current region (this may take a while :-)). I incorporated a\nslightly different TAB function, one that I use in other modes: if TAB\nis pressed while the point is not in line indentation, the line is\nindented to the column where point is (instead of just inserting a TAB\ncharacter - you can always to that with C-q C-i). This way, you can\nindent a line any time, regardless of where the point lies, by hitting\nTAB twice in succession. If you don't like this behaviour (but you\nshould), it's quite easy to add to your startup code like this:\n\n(defun caml-old-style-indent ()\n        (if (caml-in-indentation)\n                (caml-indent-command)\n                (insert \"\\t\")))\n\n(add-hook 'caml-mode-hook\n        (function (lambda ()\n                (define-key 'caml-mode-map \"\\t\"\n                        caml-old-style-indent))))\n\nYou can customize the appearance of your caml code by twiddling the\nvariables listed at the start of caml.el. Good luck. :-)\n\nOther news in caml mode are the various caml-insert-*-form commands. I\nbelieve they are self-explanatory - just do a C-h m in a caml buffer\nto see what you've got.\n\nThe ohter major news is that I changed camldebug mode considerably. I\ntook many clues from the gud \"Grand Unified Debugger\" mode distributed\nwith modern versions of Emacs. The main benefit here is that you can\ndo debugger commands _from your caml source buffer_. Commands with the\nC-c prefix in the debugger buffer have counterparts which do the same\nthing (well, a similar thing) in the source buffer, with the C-x C-a\nprefix.\n\nI made the existing debugger commands smarter in that they now attempt\nto guess the correct parameter to the underlying camldebug command. A\nnumeric argument will always override that guess. For example, the\nguess for C-c C-b (camldebug-break) is to set a breakpoint at the\ncurrent event (which was the only behaviour provided with the old\ncamldebug.el). But C-u 1 C-c C-b will now send \"break 1\" to the\ncamldebug process, setting a break at code address 1.\n\nThis also allowed me to add many more commands for which the\nunderlying camldebug commands require a parameter. The best way to\nlearn about them is to do C-h m in the camldebug buffer, and then C-h\nf for the commands you'll see listed.\n\nFinally, I added command completion. To use it, you'll have to apply\nthe provided patch to the debugger itself\n(contrib/debugger/command_line_interpreter.ml), and recompile it\n(you'll get one warning from the compiler; it is safe to ignore\nit). Then hitting TAB in the following situation, for example:\n\n(cdb) pri_\n\nwill complete the \"pri\" to \"print\".\n\nCAVEATS:\n\nI don't use X and haven't tested this stuff under the X mode of\nemacs. It is entirely possible (though not very probable) that I\nintroduced some undesirable interaction between X (fontification,\nhighlighting,...) and caml mode. I will welcome reports of such\nproblems (see REPORTING below), but I won't be able to do much about\nthem unless you also provide a patch.\n\nI don't know if the informational messages produced by camldebug are\ninternationalized. If they are, the debugger mode won't work unless\nyou set the language to English. The mode uses the messages to\nsynchronize with camldebug, and looks for fixed Emacs regular\nexpressions that match them. This may be fixed (if necessary) in a\nfuture release.\n\nBUGS:\n\nIn the debugger buffer, it's possible to overflow your mental stack by\nasking for help on help on help on help on help on help on help on\nhelp...\n\nTHANKS:\n\nXavier Leroy \u003cXavier.Leroy@inria.fr\u003e for Caml-light. Used together with the\nEmacs interface, it is about the most pleasant programming environment\nI've known on any platform.\n\nEric Raymond \u003cesr@thyrsus.com\u003e for gud, which camldebug mode apes.\n\nBarry Warsaw \u003cbwarsaw@cen.com\u003e for elp, without which I wouldn't have\nbeen able to get the indentation code to perform acceptably.\n\nGareth Rees \u003cGareth.Rees@cl.cam.ac.uk\u003e for suggestions how to speed up\nEmacs regular expression search, even if I didn't use them in the end.\n\nBill Dubuque \u003cwgd@martigny.ai.mit.edu\u003e for alerting me to the\nnecessity of guarding against C-g inside Emacs code which modifies\nsyntax tables.\n\nREPORTING:\n\nBug reports (preferably with patches), suggestions, donations etc. to:\n\nIan T Zimmerman           +-------------------------------------------+\nBox 13445                 I    With so many executioners available,   I\nBerkeley CA 94712 USA     I suicide is a really foolish thing to do.  I\nmailto:itz@rahul.net      +-------------------------------------------+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focaml%2Fcaml-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focaml%2Fcaml-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focaml%2Fcaml-mode/lists"}