Commit Graph

400 Commits

Author SHA1 Message Date
Florian Angeletti ac9c21cfcf exit with the right exit status
With OCaml 4.12.0 and later, the toplevel use the Compenv.Exit_with_status
exception to communicate when and with which status we should exit.
2021-04-03 14:38:14 -04:00
Haz ee030bab0b
Use lambdaterm resources for home path instead of sys
Co-authored-by: Fabian <copy@copy.sh>
2021-03-31 09:47:39 +02:00
Dan Sănduleac ba44fc9cc2
Utop correctly restarts when (not utop-edit-command)
## Problem

If `utop-edit-command` is nil, then `utop-query-arguments` returns nil.
This breaks `utop-restart` which relies upon it returning the right arguments.

## Solution

`utop-query-arguments` always returns `(utop-arguments)` whether it sets the utop-command or not.
2021-03-18 11:31:49 +00:00
Brian Leung 71faa5fb62 utop.el: Placate byte-compiler 2020-11-08 11:36:12 -08:00
Etienne Millon e31656e725 Fix build on 4.12
On 4.12, `Typemod.type_structure` does not take a location argument
anymore (see ocaml/ocaml#9974). This fixes the build with the 4.12
branch.
2020-10-30 16:22:14 +01:00
Haz 251228d677
Make sure we're not at $HOME before sourcing local .ocamlinit
(fixes: Github #333)
2020-09-21 22:23:36 +00:00
ZAN DoYe c0109a6da6 Vi edit mode: cross phrase register support 2020-05-30 09:27:14 +08:00
ZAN DoYe 952f97a460 compatible with 4.11
* use the exposed parser to parse longident
2020-05-12 08:45:24 +08:00
Kate 1da1f64765 Fix warnings with OCaml 4.11 2020-05-09 09:38:47 +08:00
ZAN DoYe cea5509294 add #edit_mode_default #edit_mode_vi directives 2020-04-25 23:40:41 +08:00
ZAN DoYe fd5bd4f665 UTop_main: support lambda-term 3.0 2020-04-25 23:40:41 +08:00
ZAN DoYe 692b92794d make the #use_output directive compatible with ocaml >= 4.02 2020-03-25 19:38:17 +08:00
Jeremie Dimino 3f735497d9 Backport the #use_output directive from OCaml 4.11
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2020-03-25 19:38:17 +08:00
Fabian 712678f959 Update docs to refer to .config/utop/init.ml 2020-03-18 11:01:23 +08:00
Fabian 53813ef663 Load init file from .config/utop/init.ml as per XDG conventions (fix #144) 2020-03-18 11:01:23 +08:00
ZAN DoYe 0b37fd0de8 clean up 2019-12-12 17:02:57 +08:00
ZAN DoYe 5ca427f2d2 compatible with 4.10 2019-12-12 17:02:57 +08:00
Florian Angeletti a4896483bd 4.09: Replace TypedtreeIter with Tast_iterator 2019-09-16 14:30:29 +02:00
Florian Angeletti d8248687a3 4.09: caml_sys_modify_arg rather than Obj.truncate 2019-09-16 14:28:38 +02:00
Florian Angeletti 0debad9aaf 4.09: use Persistent_env 2019-09-16 14:28:08 +02:00
ZAN DoYe 9da0951274 remove more camlp4 remnants 2019-07-16 15:08:51 -04:00
Mitchell Plamann 7bd35e08ae Remove now-broken elisp that depends on utop-ocaml-preprocessor 2019-07-15 14:36:03 -04:00
Anton Kochkov ca00ce6146 Remove camlp4 remnants 2019-07-09 11:55:13 -04:00
Hongchang Wu a589d5caee Fix typo: mode -> modes 2019-06-15 17:32:37 +08:00
Jeremie Dimino 7e8567682d Allow to statically link utop
Fixes #285

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-06-06 13:32:57 +01:00
ZAN DoYe a07156ca80 compatible with 4.03: unattached doc comment 2019-05-27 13:49:48 +08:00
ZAN DoYe 55ff32027c remove outdated doc comment 2019-05-27 13:49:48 +08:00
ZAN DoYe 928bba9896 add get_load_path and set_load_path 2019-05-27 13:49:48 +08:00
ZAN DoYe 97224e635f remove aux code 2019-05-27 13:49:48 +08:00
ZAN DoYe ad510daa99 compatible with 4.08 2019-05-27 13:49:48 +08:00
ZAN DoYe 3b1f930dfb follow the api changes of Zed_string.ends_with 2019-05-17 12:01:04 +08:00
ZAN DoYe da0fa23a05 Utop_lexer: to keep semantic consistent with the ocaml compiler, we now consider a combined double-quote to be a legal mark to start a string 2019-05-15 01:11:58 +08:00
ZAN DoYe 1ae50d3201 UTop_lexer: support editing, displaying malformed Zed_char (start with combining marks) 2019-05-15 01:11:58 +08:00
ZAN DoYe 99f28d9f17 UTop_lexer: support combined glyph for more kind of token, Symbol, Ident, Blanks, Literals... 2019-05-15 01:11:58 +08:00
ZAN DoYe dd1f834985 UTop_lexer: support combined glyph 2019-05-15 01:11:58 +08:00
ZAN DoYe fa6f1ee90f follow the changes of LTerm_history, perf regression fixed 2019-05-15 01:11:58 +08:00
ZAN DoYe 7df33e500a depend on new zed and lambda-term 2019-05-15 01:11:58 +08:00
Dmitry Bely 5637c67a7c Correct quoting for Windows command shell (#272) 2019-04-23 07:48:21 +01:00
Jeremie Dimino 4e9b9d1c66 Fix compat with 403
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-01-24 12:12:26 -05:00
Jeremie Dimino fa3880d2a2 Automatically install printers marked with [@@ocaml.toplevel_printer]
Scan newly loaded cmi files for values marked with the
[@@ocaml.toplevel_printer] attribute and automatically install them as
toplevel printers.
2019-01-24 12:12:26 -05:00
Anil Madhavapeddy 3212401775 fix or suppress some warnings in dune dev build mode 2019-01-15 09:50:54 +00:00
Anil Madhavapeddy 641af3fd63 port build from jbuilder to dune 2019-01-15 09:50:54 +00:00
Mario Rodas ea38850e60 Company backend only complete on utop buffers 2018-10-10 17:55:03 -04:00
Anton Kochkov 53db99356e Env.Env_copy_types should work also on OCaml 4.06 2018-08-31 11:35:51 -04:00
ncihnegn cf8e423f58 Replace deprecated CamomileLibraryDyn with CamomileLibraryDefault for camomile >= 1.0.0 2018-08-29 18:46:43 +01:00
ncihnegn 098d2f854b Replace deprecated String.capitalize with String.capitalize_ascii 2018-08-29 18:46:43 +01:00
ncihnegn 9dcb51fea8 Replace deprecated String.lowercase with String.lowercase_ascii 2018-08-29 18:46:43 +01:00
ncihnegn 239e6aad95 Replace deprecated Lwt_sequence with LTerm_dlist 2018-08-29 18:46:43 +01:00
Guillaume Petiot 081e49d882 Make more functions tail-recursive, and use tail-rec List functions (#251) 2018-08-23 17:53:07 +01:00
sliquister 601973c953 Clflags.include_dirs is expected to hold unexpanded directories (#242) 2018-07-09 10:28:08 +01:00
Wilfred Hughes 2d358b2d9c Fix utop-eval-phrase on recent tuareg-mode
tuareg-next-phrase was moved to tuareg_indent.el in
ocaml/tuareg@b40e733c1 and removed entirely in
ocaml/tuareg@b2ad75f3d5 (September 2017).

As a result, utop-eval-phrase crashes due to the missing function.

Instead, write a small function to move to the next phrase, similar to
the movement logic in tuareg-eval-phrase.
2018-07-06 21:02:29 +01:00
Hezekiah M. Carty 0bee8c9297 Minimal update to make utop build on OCaml 4.07.0+rc1 (#238) 2018-06-23 00:05:49 +01:00
Rudi Grinberg 90bd622f85 Don't discard line if the protocol-version isn't matched 2018-02-28 16:59:04 +07:00
Rudi Grinberg e65468882b Add version detection based on utop printing protocol-version 2018-02-28 16:28:35 +07:00
Rudi Grinberg c36f20bf12 Print protocol-version in emacs mode 2018-02-28 16:26:19 +07:00
Rudi Grinberg 27ae188261 Replace while loops with dolist 2018-02-27 01:38:12 +07:00
Rudi Grinberg 49de3344f7 Make company completion conditional 2018-02-27 00:50:42 +07:00
Rudi Grinberg 1f295f49da Add support for detecting utop version 2018-02-27 00:42:01 +07:00
Rudi Grinberg 1f3a5d66ef Company backend for utop completion 2018-02-26 22:30:00 +07:00
Rudi Grinberg 730a8aeac1
Merge pull request #216 from rgrinberg/dev
Emacs mode renovation
2018-02-26 22:29:27 +07:00
Rudi Grinberg fe8b2b8aae Prefix unused argument with _ 2018-02-26 22:23:00 +07:00
Rudi Grinberg e1e589b5ea fix cond default clause 2018-02-26 22:23:00 +07:00
Rudi Grinberg f54d1291b1 enable lexical scoping 2018-02-26 22:23:00 +07:00
Rudi Grinberg 4aafcfbbe7 remove tabuluated-list compatibility
the package already requires emacs 24, there's no need for this shim.
2018-02-26 22:23:00 +07:00
Rudi Grinberg afca031099 refactor utop-set-state, utop-cannot-edit, utop-process-line
Make them all use pcase and and gets rid of some duplicate code in the process
2018-02-26 22:23:00 +07:00
Rudi Grinberg e838896e53 Use pcase in utop-compat-resolve
Simpler than cond (and pcase is available since emacs 24)
2018-02-26 22:23:00 +07:00
Rudi Grinberg 14c2282449 fix indentation
no semantic changes here
2018-02-26 22:23:00 +07:00
Rudi Grinberg b46cf690a7 fix docstring of utop-compat-resolve
It forgot to mention the recently supported reason mode
2018-02-26 22:23:00 +07:00
tuncer 262539ae26 Fix utop -vnum (#231)
The handler for 'utop -vnum' failed to terminate after printing the
version number.
2018-02-26 12:34:37 +00:00
Rudi Grinberg 89c3355a2b Naive fix for 4.06.0 2017-11-06 18:45:27 +08:00
Rudi Grinberg 39d18c9541 Enable -safe-string everywhere
Useful for testing on OCaml < 4.06.0
2017-11-06 18:33:48 +08:00
Jeremie Dimino 202917d9d3 Resurect UTop_main.interact 2017-05-26 15:26:27 +01:00
Jeremie Dimino 1497232d4e findlib_top --> findlib.top, topkg setup 2017-05-26 14:33:20 +01:00
Andrea Richiardi ea49d8e947 Add support for Reason
Include the necessary hooks for phrase detection in Reason.
2017-05-09 07:43:46 +01:00
Jérémie Dimino fa27469e60 typo 2017-05-04 17:55:47 +01:00
Fabian 8ed78f2e39 Add command line option to enable implicitly generated bindings 2017-04-28 09:25:39 +01:00
Fabian 1639367765 Bind expressions to _0, _1, etc. (#161, #193) 2017-04-28 09:25:39 +01:00
Jérémie Dimino e0b4e635c7 Fix #205 2017-04-26 08:41:43 +01:00
Andrea Richiardi d9f198899b Refactor hooks for better handling of phrase eval, closes #201.
The patch tries to improve on the current way of evaluating a phrase and
skipping to the next. It removes both `utop-skip-to-end-of-phrase` and
`utop-skip-blank-and-comments`, but adds `utop-next-phrase-beginning`.
We assume `utop-discover-phrase` is always returning the end position as
at end of a `;;`. Thereafter we use `utop-next-phrase-beginning` to skip
to the next phase if `utop-skip-after-eval-phrase` is non-nil.
2017-04-24 07:54:13 +01:00
Deokhwan Kim 644278311d Simplify #if directives
UTop does not support OCaml < 4.02 anymore.
2017-04-20 13:55:08 +01:00
Deokhwan Kim 5e419e3f82 Run ppx preprocessors for both "input" and "input-multi" commands
Fix #192
2017-04-20 11:03:27 +01:00
Jeremie Dimino a71455b2fd Fix directive name 2017-04-11 17:36:56 +01:00
Fabian 4661944155 Add #utop_stash and #utop_save
- Strip colour terminal escapes from errors
- Store inputs and outputs seperately in UTop_history
- Add #utop_save, which prints inputs and outputs similar to a simple
  prompt
2017-04-11 17:31:58 +01:00
chrismamo1 6b8c78de58 stashing rebased (by chrismamo1) 2017-04-11 17:31:58 +01:00
Jeremie Dimino f5ee983845 Link the toplevel with -linkall 2017-04-10 18:13:54 +01:00
Jeremie Dimino 4abe1ca311 Topfind.don't_load --> Topfind.don't_load_deeply
Since we don't use `ocamlfind ocamlmktop` anymore
2017-04-10 18:13:32 +01:00
Richard Bonichon f64e9d2e78 Replace handwritten ppf with Format.formatter_of_buffer call
- Behavior is identical
- Makes utop forward compatible with merged PR 595 of ocaml trunk
2017-04-05 13:34:41 +01:00
Jeremie Dimino 2f64eb4785 restore expunge 2017-04-04 13:36:28 +01:00
Jérémie Dimino eae41f42a6 Removed camlp4/camlp5 2017-04-04 13:36:28 +01:00
Jérémie Dimino ba3d278b32 Switch to jbuilder 2017-04-04 13:36:28 +01:00
Fabian f2015062fa Mention #help in #utop_help (#190) 2016-11-16 07:47:24 +00:00
Leonid Rozenberg 7dcdfaa6a9 Tab complete mod_use directives. 2016-10-07 12:14:58 -04:00
Jeremie Dimino c6f3647a45 fix build on 4.02 2016-08-15 10:20:41 +01:00
Jeremie Dimino f630fa0afc fix conditional 2016-08-15 10:06:33 +01:00
Jeremie Dimino d888ee5ba9 Fix 4.04 compatibility
Closes #173
2016-08-15 09:32:20 +01:00
Jared Forsyth 61bfe67bfb typo 2016-07-01 07:26:50 -06:00
Jeremie Dimino 57f8ac4437 make ppx_tools dependency optional 2016-04-25 10:57:01 +01:00
whitequark 80f4b60058 Update for Asttypes.arg_label changes in 4.03.
This is required for utop to compile on 4.03.0+beta2.
2016-04-11 20:05:02 +00:00
Jeremie Dimino 35c740c312 fix 4.01 compatibility 2016-04-08 09:52:11 +01:00
Jeremie Dimino 8d12d48d32 cut search for UTop_main.interact to avoid loops 2016-03-11 16:37:46 +00:00