hack to force camlp4 to display its welcome message before the prompt in emacs

Ignore-this: fe0dee42954ec08b0465d6a57d45dd98

darcs-hash:20120202223923-c41ad-967ee6191c205214ac8d220fddc2d80c4cb9c5bc
This commit is contained in:
Jeremie Dimino 2012-02-02 23:39:23 +01:00
parent 49e59693f9
commit ed24214af0
1 changed files with 31 additions and 0 deletions

View File

@ -185,3 +185,34 @@ and loop prompt buffer length =
process prompt buffer length command argument
let () = Toploop.read_interactive_input := read_input
(* +-----------------------------------------------------------------+
| Hacks |
+-----------------------------------------------------------------+ *)
(* Force camlp4 to display its welcome message when it is loaded. *)
let () =
List.iter
(fun directive ->
let orig =
try
match Hashtbl.find Toploop.directive_table directive with
| Toploop.Directive_none func ->
func
| _ ->
ignore
with Not_found ->
ignore
in
Hashtbl.replace Toploop.directive_table directive
(Toploop.Directive_none
(fun () ->
orig ();
(* Parse something so camlp4 will display its welcome
message. *)
try
ignore (!Toploop.parse_toplevel_phrase (Lexing.from_string ""))
with _ ->
())))
["camlp4o"; "camlp4r"]