Commit Graph

411 Commits

Author SHA1 Message Date
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
Jeremie Dimino eff7153821 fix compatibility with 4.03 2016-03-02 17:46:55 +00:00
Jeremie Dimino 5bfd1ba632 setup directories properly 2016-02-24 11:08:20 +00:00
Jeremie Dimino c816baf8fb register missing compiler error printer 2016-02-24 11:03:51 +00:00
Jeremie Dimino a51d79079a handle errors in UTop_main.interact 2016-02-24 10:46:18 +00:00
Jeremie Dimino 05a0816d95 make UTop_main.interact work and add an example 2016-02-23 11:27:22 +00:00
Jeremie Dimino fa05edcc93 first try at UTop_main.interact 2016-02-23 11:06:52 +00:00
Jérémie Dimino fd7c663264 #156: start of support for quoted strings 2016-02-04 08:06:11 +00:00
Jeremie Dimino b63e0f9225 fallback to latin-1 instead of escaping with \yHH
Fixes #155
2016-02-01 08:55:17 +00:00
Jeremie Dimino 9e41bf85da Better check for async rewrite
Resolve the types Async.Std.Deferred.t instead of hard-coding a list
of aliases.

Fix #137
2016-01-07 10:30:53 +00:00
Jeremie Dimino e608977856 add a `#pwd` directive
Closes #149
2015-11-23 12:48:27 +00:00
Syohei YOSHIDA 5c58afb3de Fix non-exist function
Emacs does not have 'replace-in-string' function.
2015-11-05 19:32:03 +09:00
Jeremie Dimino 0003236802 attempt at fixing #141 2015-11-02 15:10:51 +00:00
Jeremie Dimino c41969dc62 allow to configure the external editor 2015-10-29 10:07:28 +00:00
Jeremie Dimino 8d104762ce set temporary file for external editor 2015-10-29 09:55:31 +00:00
Jeremie Dimino 2a8762c0f7 update definition of Deferred.t
It is now Async_kernel.Deferred0.t.

Fixes #137
2015-08-17 10:19:49 +01:00
Jeremie Dimino d1419acbb7 make sure is never called
This cause a failure when pressing Enter in history search mode
2015-08-07 11:03:25 +01:00
Jeremie Dimino a721d13082 update error message for utop-setup-ocaml-buffer 2015-08-06 10:58:42 +01:00
Jeremie Dimino 86c68d118e add UTop.set_margin_function 2015-08-04 11:44:36 +01:00
Jeremie Dimino fccbafa75b don't trust locations returned by the compiler 2015-08-04 11:26:28 +01:00
Jeremie Dimino 92fafe1f48 Add UTop.end_and_accept_current_phrase
Closes #131
2015-05-12 16:46:24 +01:00
Jeremie Dimino 90ffbe737a build with trunk 2015-03-18 16:47:29 +00:00
Jeremie Dimino 0a386c3fb8 use simpler emacs features for utop-compat-resolve
Some people have complained about this in the past IIRC.
2015-01-12 09:56:50 +00:00
Jeremie Dimino 1fa1b1f0b3 simplify utop-compat-resolve
No need to try loading one of the major mode as utop-mode is now a
minor mode and has to be used in conjunction with the current major
mode of the buffer.
2015-01-12 09:36:54 +00:00
Mads Hartmann Jensen 6e7314861e Code review by @diml
- Changed default key-binding for utop to C-c C-s to match tuareg
  default
- Add some compatibility functions to make the transition easier for
  existing users
2015-01-11 13:20:03 +01:00
Mads Hartmann Jensen ff3a379c5b Use autoload cookies 2015-01-02 13:06:48 +01:00
Mads Hartmann Jensen 1290b09521 A step closer to not relying on other major mode's variables 2015-01-02 12:11:02 +01:00
Mads Hartmann Jensen 3c958ebf2e Use minor mode rather than overriding variables at runtime 2015-01-02 11:44:08 +01:00
Peter Zotov 884328596a Re-export Config.load_path as UTop.load_path
This change helps to implement toplevel extensions that want
to find files in the load path, e.g. for improved error messages.
2014-12-11 23:25:12 +03:00
Peter Zotov ff18d998b5 Add findlib predicate pkg_utop
This allows required packages to distinguish whether they are
loaded in regular toplevel or in utop, and thus call Toploop
functions or those in UTop.
2014-12-11 13:47:03 +03:00
Peter Zotov 970b308126 Use tuple comparisons, present since cppo 1.1.2. 2014-11-17 17:58:12 +03:00
Jérémie Dimino b7259ae286 Merge pull request #111 from mads379/master
#108 Enable utop-command to be buffer-local
2014-11-05 11:59:39 +01:00
Mads Hartmann Jensen 137151cca9 #108 Enable utop-command to be buffer-local 2014-11-04 17:44:28 +01:00
Peter Zotov 3fe804e340 Fix 4.01 compatibility. 2014-10-22 18:22:52 +04:00
Peter Zotov f17f8f2959 Print out a nice message if trying to load camlp4 with no support.
This handles #camlp4o;; #camlp4r;; and also indirect cases
like #require "sexplib.syntax";;.
2014-10-20 20:04:18 +04:00
Peter Zotov 789417bfce Migrate from deprecated Format functions. 2014-10-20 17:14:39 +04:00
Peter Zotov 2eea83a65f Remove unused/deprecated autodetection from myocamlbuild.ml.
FINDLIB_VERSION is not used anymore.

compiler-libs are provided as a package in findlib >=1.4.

errors.cmi is now provided by compiler-libs.
2014-10-20 17:14:39 +04:00
Peter Zotov 6f7ac4559f Remove compatibility with pre-4.01.0. 2014-10-20 17:14:39 +04:00
Peter Zotov 121b1a9e58 Get rid of lwt.syntax. 2014-10-20 16:20:55 +04:00
Peter Zotov 257bfa7eb6 Replace pa_optcomp with cppo. 2014-10-20 16:20:55 +04:00
Maverick Woo 2116ebdcfc change error message formatting of #require
Before:
  utop # #require "foo";;
  No such package: foo""
After:
  utop # #require "foo";;
  No such package: foo

The quoted empty string due to %S can be confusing to students.
2014-10-17 11:57:32 -04:00
Peter Zotov ea45f25c73 Implement wrapper for -safe-string (fixes #93). 2014-09-08 23:25:25 +04:00
Mads Hartmann Jensen 064d874e61 Prettier fix for closing completion buffer 2014-08-21 22:35:26 +02:00
Mads Hartmann Jensen 081a10dadd Close *Completions* buffer after evaluation
This is a quick fix for #84. There might be a better place in the
code for the fix but this certainly does the trick.
2014-08-21 19:06:08 +02:00
Jeremie Dimino 50a398744a handle Syntaxerr.Ill_formed_ast 2014-08-18 11:29:34 +01:00
Jeremie Dimino fac09516fc ignore completion errors from invalid cmis 2014-08-18 11:27:03 +01:00
Peter Zotov 1541f25520 Fix compatibility with 4.02. 2014-08-07 15:31:14 +04:00
Jeremie Dimino 87b0ca1807 handle module aliases for completion 2014-07-30 13:49:59 +01:00
Jeremie Dimino 8d35b32af0 fix #77 2014-07-28 10:18:45 +01:00
Peter Zotov 495336f330 Fix build on 4.00.1 and earlier. 2014-07-05 02:17:01 +04:00
Jeremie Dimino deccc8ea16 Don't stylise uge strings
Fix #73
2014-06-24 14:26:09 +01:00
Jeremie Dimino 6124f722f0 fix for trunk 2014-05-14 11:37:13 +01:00
Peter Zotov cc8793665f Revert "Add a shim for #ppx directive for 4.02."
This reverts commit 5cda9ffb99.

The patch was accepted into 4.02 after all:
11bf27a936
2014-05-13 18:41:50 +04:00
Peter Zotov 1dc2409107 Don't execute all phrases twice on >=4.02 (fixes #69). 2014-05-12 14:25:44 +04:00
Peter Zotov c179eadcdb Implement autocompletion for #ppx. 2014-05-07 19:37:46 +04:00
Peter Zotov 5cda9ffb99 Add a shim for #ppx directive for 4.02.
The patch that adds it was accepted, but missed the merge window
for 4.02: https://github.com/ocaml/ocaml/pull/54#issuecomment-42351331
2014-05-07 19:35:37 +04:00
Peter Zotov 8c09e086f5 Run ppx preprocessors before typing and report their errors gracefully. 2014-05-06 21:37:32 +04:00
Peter Zotov 5305027a36 Update for 4.02. 2014-05-06 20:18:39 +04:00
Peter Zotov 0c745bcef5 Implement -dparsetree and -dsource options (refs #51). 2014-05-02 19:43:30 +04:00
Peter Zotov 72a7e7bfbe Implement -ppx option (fixes #63). 2014-05-02 19:38:57 +04:00
Jeremie Dimino b0795906e5 fix for trunk 2014-05-02 10:58:05 +01:00
Jeremie Dimino 5be7134436 silence camlp4 2014-04-24 09:11:19 +01:00
Jeremie Dimino d082071cea supports -require for scripts 2014-04-11 16:06:09 +01:00
Daniel Bünzli 089aed899a Support for React 1.0.0. 2014-03-27 13:58:45 +01:00
Martin Trojer 3fdec164a8 better boiler plate 2014-03-07 21:47:37 +00:00
Martin Trojer 7290a63513 some boilerplate so utop.el can go up on melpa (http://melpa.milkbox.net/) 2014-03-07 14:59:29 +00:00
Jeremie Dimino 6101de8028 fix previous commit 2014-02-14 10:01:48 +00:00
Jeremie Dimino 991ae65caa make utop work with trunk 2014-02-14 09:53:18 +00:00
Jeremie Dimino 938da825d3 add Async_kernel.Ivar.Deferred.t to the async hack
Fixes janestreet/async_kernel#2
2014-02-10 09:42:34 +00:00
Jeremie Dimino cb2711067f emacs-mode: [tab] --> (kbd "TAB")
fixes #54
2014-01-17 09:17:53 +00:00
Jeremie Dimino ee400fe51b complete on #load_rec the same way as #load
closes #52
2014-01-09 08:46:16 +00:00
Jeremie Dimino 578c3771c5 add the -require command line argument 2013-12-10 15:19:10 +00:00
Jeremie Dimino 52d0f02e0a add option -no-autoload 2013-11-26 13:48:34 +00:00
Jeremie Dimino 5b0adae849 fix startup files autoloading and allow to disable it 2013-11-26 13:22:36 +00:00
Jeremie Dimino d11d83ba65 fix #7: avoid a stack overflow in UTop_lexer 2013-11-20 10:58:33 +00:00
Jeremie Dimino bc85016584 fix #38
Handle errors from custom camlp4 ast filters
2013-11-20 09:41:06 +00:00
Jeremie Dimino d6e3dd0551 load every files in $OCAML_TOPLEVEL_PATH/autoload at startup 2013-11-04 12:58:15 +00:00
Jeremie Dimino cad0bb92da avoid record disambiguation warning 2013-10-25 10:52:32 +01:00
Jeremie Dimino 3f5ebae989 more syntax errors 2013-10-25 10:52:05 +01:00
Thomas Refis 7d56719b15 add completion on typeof directive 2013-10-16 14:33:02 +02:00
Thomas Refis 7b1984b7bc extend typeof directive 2013-10-16 10:18:44 +02:00
Jeremie Dimino 5e99e350c2 fix compilation with ocaml < 4.01 2013-08-08 11:50:17 -04:00
Jeremie Dimino e4962e3f73 fix #30 2013-08-07 12:35:02 -04:00
Jeremie Dimino 893cd5f327 compile with findlib < 1.4 2013-08-07 12:10:10 -04:00
Jeremie Dimino 5b5839c039 hide topfind messages 2013-08-07 11:57:28 -04:00
Jeremie Dimino 99618eafd7 don't fail when a search path does not exist 2013-07-15 12:49:40 +01:00
Jeremie Dimino 3df2cccf51 change the trick for getting type errors
Instead of generating "module (_ : sig end) = struct <phrase> end", we
generate "let _ () = let module _ = struct <phrase> end in ()". This
avoid type errors due to the use of first-class module inside a
functor.
2013-07-15 09:24:18 +01:00
Jeremie Dimino e02a18b4d7 set the filename in the lexbuf 2013-07-12 12:02:18 +01:00
Jeremie Dimino 586bfbdc04 add the #typeof directive 2013-07-10 16:51:52 +01:00
Jeremie Dimino cbc658ca41 handle LTerm_inputrc.Parse_error 2013-07-08 11:04:05 +01:00