Prelimnary support for "require:" command - in progress. Handle links in buttons
Ignore-this: 148a3142a2f40cc05f887cb0c53712fb darcs-hash:20120301035606-33bd9-14ca041ed4b73a645a5251a4fff63774490d8766
This commit is contained in:
parent
98f032b5a5
commit
f91647a254
|
@ -652,6 +652,16 @@ 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;
|
||||
loop_commands history_prev history_next
|
||||
| Some (command, _) ->
|
||||
Printf.ksprintf (send "stderr") "unrecognized command %S!" command;
|
||||
exit 1
|
||||
|
|
|
@ -789,10 +789,18 @@ defaults to 0."
|
|||
(defun utop-package-printer (id cols)
|
||||
"Print one findlib package entry."
|
||||
(let ((width (cadr (elt tabulated-list-format 0))))
|
||||
(insert-text-button (elt cols 0) 'face nil)
|
||||
(insert-text-button (elt cols 0)
|
||||
'follow-link t
|
||||
'action 'utop-require-package-button-action)
|
||||
(insert-char ?\s (- width (length (elt cols 0))))
|
||||
(insert (elt cols 1) "\n")))
|
||||
|
||||
(defun utop-require-package-button-action (button)
|
||||
(let ((package (button-label button)))
|
||||
(when (y-or-n-p (format "Load package `%s'? " package))
|
||||
;; Handle loading of packages
|
||||
nil)))
|
||||
|
||||
(defun utop-list-ocaml-packages (&optional buffer)
|
||||
"Display a list of all ocaml findlib packages"
|
||||
(interactive)
|
||||
|
|
Loading…
Reference in New Issue