From d7ae407aba9fe9bca91d5b29cba1e731a16b7f1b Mon Sep 17 00:00:00 2001 From: Bence Fabian Date: Thu, 5 Oct 2023 12:27:16 +0200 Subject: [PATCH] Fix: Make emacs mode respect implicit bindings --- src/lib/uTop_main.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/uTop_main.ml b/src/lib/uTop_main.ml index e786f54a..912138fc 100644 --- a/src/lib/uTop_main.ml +++ b/src/lib/uTop_main.ml @@ -751,10 +751,10 @@ let rec loop term = match phrase_opt with | Some phrase -> (* Rewrite toplevel expressions. *) - let count = S.value UTop_private.count in let phrase = rewrite phrase in let phrase = if UTop.get_create_implicits () then + let count = S.value UTop_private.count in let binding_name = Printf.sprintf "_%d" count in bind_expressions binding_name phrase else @@ -975,6 +975,14 @@ module Emacs(M : sig end) = struct let process_checked_phrase phrase = (* Rewrite toplevel expressions. *) let phrase = rewrite phrase in + let phrase = + if UTop.get_create_implicits () then + let count = S.value UTop_private.count in + let binding_name = Printf.sprintf "_%d" count in + bind_expressions binding_name phrase + else + phrase + in try Env.reset_cache_toplevel (); ignore (execute_phrase true Format.std_formatter phrase);