Skip to content

pfitaxel/learn-ocaml.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

learn-ocaml.el

Build Status

Summary

learn-ocaml.el is an Emacs frontend for students using learn-ocaml.

Dependencies

(version 25.1 or later)

(version 0.12 or later)

It can be installed with opam (the OCaml package manager) in a 4.05.0 switch:

  • If you already have a .opam folder, you should just need to type:

      opam update -y
      opam switch create 4.05.0 ocaml-base-compiler.4.05.0
      eval $(opam env)
      opam install -y learn-ocaml-client
    
  • otherwise, make sure you have opam 2.0, then run:

      opam init --auto-setup --yes --compiler=ocaml-base-compiler.4.05.0
      eval $(opam env)
      opam install -y learn-ocaml-client
    

Note: beyond learn-ocaml-client, you may want to install a comprehensive OCaml/Emacs environment (with Tuareg, Merlin, Company): for details, see https://github.com/erikmd/tapfa-init.el (in French)

Usage (manual installation procedure before MELPA availability)

Clone the GitHub repo:

git clone https://github.com/pfitaxel/learn-ocaml.el ~/.emacs.d/lisp/learn-ocaml.el

Add the following to your .emacs and restart Emacs:

;; Make available the learn-ocaml-mode
(load "~/.emacs.d/lisp/learn-ocaml.el/learn-ocaml.el")

Enable the minor mode in any buffer:

M-x learn-ocaml-mode RET

Follow the instructions regarding the server URL and token (which will automatically be stored in ~/.config/learnocaml/client.json).

Open the LearnOCaml menu or directly start an exercise from the *learn-ocaml-exercise-list* buffer.

Then, the learn-ocaml-mode will automatically be activated when opening .ml buffers using tuareg-mode and the following keybindings will be available:

  • (learn-ocaml-grade): C-c C-m C-m (= C-c RET RET)

  • (learn-ocaml-display-exercise-list): C-c C-m C-l (= C-c RET C-l) or C-c C-m l (= C-c RET l)

Known limitations

  • When used jointly with Merlin, if the learn-ocaml exercise contains a nonempty prelude, Merlin may trigger errors such as Unbound value foo although foo is defined in the server exercise. Note that this issue does not impact the learn-ocaml.el grading feature which already works in this use case. But ultimately, we will provide a dedicated support to workaround this Merlin issue, which thus occurs if the server exercise provides some prelude.ml and/or prepare.ml code.

Feedback

Bug reports and suggestions are very welcome: feel free to open a new issue or PR.

Authors and Acknowledgments

learn-ocaml.el has been developed in University Toulouse III by Erik Martin-Dorel and Manuel Cabarcos Baulina, thanks to the support of the OCaml Software Foundation.

License

learn-ocaml.el is a free software distributed under the MIT License.

About

Emacs mode for students using the learn-ocaml platform (https://ocaml-sf.org/learn-ocaml) [maintainer=@erikmd]

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •