interactive list of packages now work in Emacs

Ignore-this: f5beeb274d704e63b8520b91ad33b39b

darcs-hash:20120303175448-33bd9-2fca1cf41d9a66bfcbd75262b64bc41a25774fc7
This commit is contained in:
wojciech.meyer 2012-03-03 18:54:48 +01:00
parent 01263d3532
commit 023e72933d
2 changed files with 15 additions and 10 deletions

View File

@ -652,15 +652,12 @@ module Emacs(M : sig end) = struct
| Some ("save-history", code) ->
Lwt_main.run (save_history ());
loop_commands history_prev history_next
| Some ("require", arg) ->
begin
let input = read_data () in
send "accept" "";
try
Topfind.load_deeply [input]
with Fl_package_base.No_such_package(pkg, reason) ->
send "no-such-package" ""
end;
| Some ("require", package) -> begin
try
Topfind.load_deeply [package]
with Fl_package_base.No_such_package(pkg, reason) ->
send "no-such-package" pkg
end;
loop_commands history_prev history_next
| Some (command, _) ->
Printf.ksprintf (send "stderr") "unrecognized command %S!" command;

View File

@ -187,6 +187,13 @@ to add the newline character if it is not accepted).")
(inhibit-read-only t))
(progn ,@actions)))
(defun utop-send-string (str)
(if (not (bufferp utop-buffer-name))
(utop)
(when (eq utop-state 'done) (utop-restart)))
(with-current-buffer utop-buffer-name
(process-send-string utop-process str)))
(defun utop-insert (&rest args)
"Insert text with checks inhibited."
(utop-perform (apply 'insert args)))
@ -801,7 +808,8 @@ defaults to 0."
(let ((package (button-label button)))
(when (y-or-n-p (format "Load package `%s'? " package))
;; Handle loading of packages
nil)))
(utop-send-string (format "require:%s\n" package))
)))
(defun utop-list-ocaml-packages (&optional buffer)
"Display a list of all ocaml findlib packages"