Hi all, In accordance with my (totally not ad-hoc) annual release strategy, I am pleased to announce the latest release of Gopcaml-mode - an Emacs plugin for structural editing of OCaml code - this version comes with a host of new features, as well as a wider support of OCaml versions (4.08 to 4.12.0).
If you haven’t heard of Gopcaml-mode before, or aren’t sold on the idea, here’s a quick peek at what you can do with the power of semantic structural editing:
Pay attention to how the cursor moves - each one of these jumps is done by expressing a semantic movement (i.e, things like - move to pattern C-c C-p
to jump to the nearest enclosing wildcard pattern, or move to nearest let-def C-c C-o
to jump to the nearest let binding, etc.).
I’d recommend checking out the release post for version 0.0.1 for a wider selection of examples of what exactly Gopcaml-mode can do, and how you can install it.
More Pretty Pictures
- new! Proper support for inter-pattern movement and jump to wildcard (see above gif)
-
new! Full OCaml Syntax Support for movements
-
new! Compatibility with buffers with accents
Detailed Changelog
-
Updated to work with OCaml 4.12.0
- Updated to depend on ocaml-migrate-parsetree, back-porting support back to OCaml.4.08.0+
-
Improved support for jumping to nearest pattern
- Pressing C-c C-p will now jump to the nearest enclosing wildcard or pattern if no wildcard exists
- C-c C-o operates as normal for jumping to the nearest let definition
- Added support for moving within patterns
- Added support for moving within types
-
improved quality of main Ast_zipper code
- more comments
- refactoring TextRegion module to a separate file so it may be reused for other analyses
-
Added support for excluding files
- Now does not complain when opening ocamllex or menhir files
- see
gopcaml-ignored-extensions
variable for more information
-
Fixed ordering of parameters when using optional arguments
- previously optional arguments would appear before their bindings
-
Added better support for multi-byte strings
- previously, use of multi-byte strings would cause overlays to
desynchronise with the code - the OCaml parser represents offsets and ranges in terms of byte offsets, while the conversion functions being used in the program (Position.of_int_exn) assumed they were code points
- the existing code would function correctly on buffers using only single-byte characters, but would fail on buffers with multi-byte buffers
- now our unicode using foriegn-language friends can too enjoy the power of Gopcaml mode!
- previously, use of multi-byte strings would cause overlays to
- Fixed bug with transpose expression
Get Gopcaml-mode
Its as easy as 1, 2, 3!
- Install from opam:
opam install gopcaml-mode
-
Compile your emacs with support for dynamic modules
-
Load gopcaml-mode in your init.el:
(let ((opam-share (ignore-errors (car (process-lines "opam" "config" "var" "share")))))
(when (and opam-share (file-directory-p opam-share))
;; Register Gopcaml mode
(add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
(autoload 'gopcaml-mode "gopcaml-mode" nil t nil)
(autoload 'tuareg-mode "tuareg" nil t nil)
(autoload 'merlin-mode "merlin" "Merlin mode" t)
;; Automatically start it in OCaml buffers
(setq auto-mode-alist
(append '(("\\.ml[ily]?$" . gopcaml-mode)
("\\.topml$" . gopcaml-mode))
auto-mode-alist))
))
See the release post for version 0.0.1 for detailed instructions on how you can install it.