Commit Graph

98 Commits

Author SHA1 Message Date
Bozhidar Batsov e89802f24c Address a compilation warning 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 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
Bozhidar Batsov 1a7c112a71 Add :safe properties to defcustoms 2022-07-16 11:32:15 -05:00
Bozhidar Batsov a84d499301 Remove redundant :group properties
Those are auto-inferred from the :prefix set in defgroup.
2022-07-16 11:32:15 -05:00
Bozhidar Batsov 2c08182649 Add some package description
package.el repos typically extract and show this info.
2022-07-16 11:32:15 -05:00
Bozhidar Batsov ec1f09420d Reformat a couple of let bindings
This makes it easier to see the definitions they introduce.
2022-07-16 11:32:15 -05:00
Bozhidar Batsov c117c6cf57 Use #' for function references where appropriate 2022-07-16 11:32:15 -05:00
Bozhidar Batsov dee6a8752a Use the kbd macro for all keybindings
This makes more complex keybindings easier to read and write.
2022-07-16 11:32:15 -05:00
Bozhidar Batsov b24f94243f Update a few URL references 2022-07-16 11:32:15 -05:00
Christian Pellegrin ec469bb839 Fix emacs completion returning bogus candidates.
In standalone mode, utop returns all the possible completions when no
one matches what the user has typed. This is surprising in emacs
because of the different UI/UX. For this reason, we keep a list of
prefixes for which completion has started and return only the
candidates which match the prefixes.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
2021-06-07 12:40:48 -07:00
Rudi Grinberg 1660e5989a
Merge pull request #347 from dansanduleac/patch-1
Utop correctly restarts when (not utop-edit-command)
2021-04-03 20:18:13 -07:00
Rudi Grinberg b2f15bff67
Merge pull request #340 from leungbk/byte-comp
utop.el: Placate byte-compiler
2021-04-03 20:13:38 -07:00
Brian Leung e5059d2e2f utop.el: Fix utop-tuareg-next-phrase for newer tuareg.el
tuareg--after-double-colon no longer exists in the latest rev of
Tuareg, which has received 110 additional commits since the last
release version on OPAM, so inline the old definition, which was
removed in commit 91ba1d6143558092a3920e9b5c49755c0c86caed of Tuareg.

tuareg--skip-double-colon was renamed to
tuareg--skip-double-semicolon, and also received a slight change.
Inline that as well since it's a private function.
2021-04-03 21:24:20 -04: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
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
Mario Rodas ea38850e60 Company backend only complete on utop buffers 2018-10-10 17:55:03 -04: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
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 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 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
Andrea Richiardi ea49d8e947 Add support for Reason
Include the necessary hooks for phrase detection in Reason.
2017-05-09 07:43:46 +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
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 a721d13082 update error message for utop-setup-ocaml-buffer 2015-08-06 10:58:42 +01: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
Mads Hartmann Jensen 137151cca9 #108 Enable utop-command to be buffer-local 2014-11-04 17:44:28 +01: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