Commit Graph

656 Commits

Author SHA1 Message Date
Riku Silvola 40c1b32a7c
Adopt the OCaml Code of Conduct (#436) 2023-07-03 11:08:07 +02:00
Etienne Millon 4e6aae168c
Remove deprecated values (#427)
Follow-up to #415: we remove these values.
2023-06-23 17:16:36 +02:00
Thibaut Mattio 351741b820
Check Zed.next_error index value is within the string length (#442)
This fixes Zed.Out_of_bound errors

Co-authored-by: Etienne Millon <me@emillon.org>
2023-06-23 15:09:05 +02:00
Etienne Millon 87871f442e
Add test for fix_string (#443) 2023-06-23 14:28:14 +02:00
Etienne Millon e885c5ee93
expunge: move system code to dune (#439)
The logic to create utop from utop-full is as follows:

- use ocamlobjinfo on utop-full to determine which modules are used
- use ocamlobjinfo on ocamlcommon, ocamlbytecomp, and ocamltoplevel to
  determine which modules to exclude (a priori)
- compute the set used - (exclude - {Topmain,Toploop,Topdirs})
- call expunge with this set of modules

Previously, this was all done in expunge/expunge.ml, meaning core logic
+ process handling.
What this PR does is offload the process handling to dune: calling
ocamlobjinfo and expunge is done instead in dune rules, and
expunge/modules.ml is just about reading sets of module names and
outputing the result.

Besides simplicity and portability, the other advantage is that the
intermediate modules.txt can be inspected directly.
2023-06-23 13:56:38 +02:00
Etienne Millon bfabaacf2a
use lang 2.0 and format dune files (#440) 2023-06-23 11:37:09 +02:00
Etienne Millon fc32fa37a1
Generate opam file (#441)
* Use opam file generation

* autogenerate dune

* Do not use {build}

* do not hard wrap description
2023-06-23 10:37:01 +02:00
Garth Tuohy f2f2aef137 More compatible fix 2023-06-12 11:38:04 +02:00
Etienne Millon ba0e2c7fff 2.12.1 2023-04-21 12:19:08 +02:00
Etienne Millon a922be057f fix regression with unit qualification
Fixes #428

The change in #418 introduced a regression if a `Unit` module in scope
does not have a `()` constructor in it.

This switches to the more explicit `Stdlib.Unit.()` path.
2023-04-21 12:18:30 +02:00
Jake Shilling 0e9f0c6893 emacs: implement completion-at-point
Fixes #261
2023-04-19 16:14:59 +02:00
Etienne Millon c50173caf9 2.12.0 2023-04-17 13:37:45 +02:00
Etienne Millon ed895283db Qualify () constructor
We are building a hidden expression that contains "()" but it is not
qualified. So it will pick the constructor in scope. This can cause
problems if `()` has been redefined. The correct fix is to qualify it as
part of the `Unit` module.

(additionally, this removes an unused ident)

Fixes #417
2023-04-17 13:36:23 +02:00
Etienne Millon 1a70e0fb85 Do not pass -safe-string explicitly
Strings are safe now.
2023-04-17 13:34:23 +02:00
Etienne Millon 78349cc4b8 Fix add_let 2023-04-12 10:23:15 +02:00
Etienne Millon 846af28b3c OCaml 5.1 support 2023-04-12 10:23:15 +02:00
Vu Ngoc San 4eba6f132b use M-down instead of M-tab 2023-03-07 14:31:54 +01:00
Etienne Millon 13011b0d45 Move compat functions to their module
The utop code base is full of #if OCAML_VERSION to adapt to the changes
in compiler-libs. This has some issues - for example the corresponding
logic is harder to recognize, and some logic is duplicated in several
places. Also, this prevents using a formatter.

One medium-term goal is to move most of the compat functions to a new
Utop_compat module which would be the only place we use cppo.

This contains the "easy" cases - moving existing functions, etc. It is a
bit more difficult (and controversial) to convert pattern matching to
this pattern so it'll be done separately.
2023-02-22 11:51:32 +01:00
Etienne Millon ace481388a Mark deprecated values with attribute
They have been deprecated in 2012 and most of them are ignored.
2023-02-02 16:39:37 +01:00
Etienne Millon 595002e6f0 Release 2.11.0 2023-01-05 15:30:54 +01:00
Etienne Millon 5aae06f007 Do not display a backtrace when exiting normally
Exiting normally here refers to the `Exit_with_status` exception.
It is in particular triggered by `#quit;;` so we want to exit quietly
in that case.

Closes #398
2023-01-05 15:21:51 +01:00
Brian Leung c596ac7b88
Shut up Emacs 29's byte-compiler (#404)
* Shut up Emacs 29's byte-compiler

* Fix docstring to comply with checkdoc
2022-11-03 08:46:06 -06:00
Brian Leung 263428053b
Recommend `opam exec` instead of deprecated `opam config exec` (#403) 2022-11-02 21:37:01 -06:00
Brian Leung 0cb4ffe584
utop.el: always insert phrase terminator at the end-ish of input (#402)
* utop.el: always insert phrase terminator at the end-ish of input

When point is at the letter "n" in

utop[1]> let thi[n]g = 42

or in

utop[2]> let thi[n]g = 8734;

and the user presses C-j, it is always because they want to terminate
the expression at the end-ish of the input.

The unpatched behavior did not move point, and inserted two semicolons
in the middle of the expression.
2022-11-02 18:27:07 -06:00
metanivek bbd9a6ed45 feature: Add toplevel_printer support for functors 2022-07-27 11:10:32 -05:00
Etienne Millon f9b5ec7266
Merge pull request #393 from emillon/408
Bump the compat to 4.08+
2022-07-21 10:15:10 +02:00
Etienne Millon 7a1d87e2da Update changelog 2022-07-20 14:20:01 +02:00
Bozhidar Batsov ebca87c7a3 Try to appease checkdoc
Things like 'done are not allowed in docstrings.
2022-07-19 16:11:42 -05:00
Bozhidar Batsov c850fd9927 Fix an anchor 2022-07-19 16:11:42 -05:00
Bozhidar Batsov 62cb68c817 Mention reason-mode in the README 2022-07-19 16:11:42 -05:00
Bozhidar Batsov 036eac86b0 Remove a deprecated function
I think we can safely assume 7 years are enough time for most people
to have learned about `utop-minor-mode`.
2022-07-19 16:11:42 -05:00
Bozhidar Batsov b8b8dd6d8d Remove some dead code
Seems 9 years ago someone tried to extract types from the evaluation
results but never got this working. I think it's time for this code to
go away, given that we have much better options today (e.g. Merlin).
2022-07-19 16:11:42 -05:00
Bozhidar Batsov bfbe143ce1 Rename utop-is-running to utop-running-p
That's the Emacs convention for predicates.
2022-07-19 16:11:42 -05:00
Bozhidar Batsov 9c0a55f2c0 Fix the :active checks in the minor mode's menu
When there you need to retrieve the utop buffer first - you can't
check for the state directly.
2022-07-19 16:11:42 -05:00
Bozhidar Batsov 6658ca4c21 Fix some typos 2022-07-19 16:11:42 -05:00
Bozhidar Batsov 2bee980a9d Add C-c C-e as an alias for C-x C-e
That's the practice in most similar Emacs modes.
2022-07-19 16:11:42 -05:00
Bozhidar Batsov 5049cd9344 Add missing keybinding for utop-switch-to-recent-buffer 2022-07-19 16:11:42 -05:00
Etienne Millon a05100db32 Bump the compat to 4.08+
Utop supports a wide range of OCaml versions, but this is getting more
difficult to support. In addition, some of the dependencies we use do
not support 4.03-4.07, so utop can not be built on these versions.
2022-07-19 11:38:52 +02:00
Etienne Millon b3296f0b73
Merge pull request #394 from emillon/remove-nix-build
Remove nix build
2022-07-19 11:37:36 +02:00
Etienne Millon d128af2e13 Remove nix build
This build does not work, we don't have an easy way to keep the
lockfiles updated, and we now have ocaml-ci covering the builds.
2022-07-19 11:28:52 +02:00
Etienne Millon e2a765f36f
Merge pull request #396 from emillon/removed-string-set
Handle Syntaxerr.Removed_string_set
2022-07-19 11:28:07 +02:00
Etienne Millon 8c2039543b Handle Syntaxerr.Removed_string_set 2022-07-19 11:07:42 +02:00
Bozhidar Batsov e89802f24c Address a compilation warning 2022-07-18 15:34:13 -05:00
Bozhidar Batsov 8149df9132 Add a complication check GHA
It's based on Eldev.
2022-07-18 15:34:13 -05:00
Bozhidar Batsov 2a405226f2 Add commands to switch to and from a utop buffer
Those are extremely common in Emacs modes and allow people to
quickly jump to a REPL and back to the last source buffer they
were editing, while using the same keybinding.

I've modeled the implementation here after that of inf-clojure (a similar
mode written by me). I've also implemented a mode menu for
utop-minor-mode, so it's easier for the users to discover its
functionality.
2022-07-18 14:29:54 -05:00
Bozhidar Batsov 09d26a7509 Use defvar-local where appropriate 2022-07-18 10:04:04 -05:00
Bozhidar Batsov ba18d8ad38 Group the major mode code more tightly 2022-07-18 10:04:04 -05:00
Bozhidar Batsov 4673c07aa4 Improve the Emacs documentation 2022-07-18 10:04:04 -05:00
Bozhidar Batsov f91c126afb [Fix #389] Require Emacs 26 in utop.el 2022-07-18 10:04:04 -05:00
Bozhidar Batsov e7b1ff36d1 [Fix #358] Fix code completion for module identifiers in utop.el
Without those changes you won't get any completion for things like
"List.m". I'm not very familiar with the code, but it seems that the
backend returns the completion candidates without the module prefix
which caused the problem.

I've opted to fix this by handling prefixes with a "." in them specially
and this works fine in the limited testing I conducted locally.
2022-07-16 13:32:11 -05:00