ghc-import-module uses ghc-modi browse.
This commit is contained in:
parent
3dc8e345b2
commit
36e32ab1b2
@ -69,7 +69,6 @@ unloaded modules are loaded")
|
|||||||
(defvar ghc-loaded-module nil)
|
(defvar ghc-loaded-module nil)
|
||||||
|
|
||||||
(defun ghc-comp-init ()
|
(defun ghc-comp-init ()
|
||||||
(add-hook 'find-file-hook 'ghc-import-module)
|
|
||||||
(let* ((syms '(ghc-module-names
|
(let* ((syms '(ghc-module-names
|
||||||
ghc-language-extensions
|
ghc-language-extensions
|
||||||
ghc-option-flags
|
ghc-option-flags
|
||||||
@ -110,27 +109,19 @@ unloaded modules are loaded")
|
|||||||
;;;
|
;;;
|
||||||
|
|
||||||
(defun ghc-boot (n)
|
(defun ghc-boot (n)
|
||||||
(ghc-executable-find ghc-module-command
|
(prog2
|
||||||
(ghc-read-lisp-list
|
(message "Initializing...")
|
||||||
(lambda ()
|
(ghc-sync-process "boot\n" n)
|
||||||
(message "Initializing...")
|
(message "Initializing...done")))
|
||||||
(ghc-call-process ghc-module-command nil t nil "-l" "boot")
|
|
||||||
(message "Initializing...done"))
|
|
||||||
n)))
|
|
||||||
|
|
||||||
(defun ghc-load-modules (mods)
|
(defun ghc-load-modules (mods)
|
||||||
(if (null mods)
|
(if mods
|
||||||
(progn
|
(mapcar 'ghc-load-module mods)
|
||||||
(message "No new modules")
|
(message "No new modules")
|
||||||
nil)
|
nil))
|
||||||
(ghc-executable-find ghc-module-command
|
|
||||||
(ghc-read-lisp-list
|
(defun ghc-load-module (mod)
|
||||||
(lambda ()
|
(ghc-sync-process (format "browse %s\n" mod)))
|
||||||
(message "Loading names...")
|
|
||||||
(apply 'ghc-call-process ghc-module-command nil '(t nil) nil
|
|
||||||
`(,@(ghc-make-ghc-options) "-l" "browse" ,@mods))
|
|
||||||
(message "Loading names...done"))
|
|
||||||
(length mods)))))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;
|
;;;
|
||||||
|
@ -84,6 +84,16 @@
|
|||||||
(ghc-add ret (read m))))
|
(ghc-add ret (read m))))
|
||||||
(error ()))))
|
(error ()))))
|
||||||
|
|
||||||
|
(defun ghc-read-lisp-list-this-buffer (n)
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(condition-case nil
|
||||||
|
(let ((m (set-marker (make-marker) 1 (current-buffer)))
|
||||||
|
ret)
|
||||||
|
(dotimes (i n (nreverse ret))
|
||||||
|
(ghc-add ret (read m))))
|
||||||
|
(error ()))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun ghc-mapconcat (func list)
|
(defun ghc-mapconcat (func list)
|
||||||
|
@ -81,19 +81,25 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defvar ghc-process-rendezvous nil)
|
(defvar ghc-process-rendezvous nil)
|
||||||
|
(defvar ghc-process-num-of-results nil)
|
||||||
(defvar ghc-process-results nil)
|
(defvar ghc-process-results nil)
|
||||||
|
|
||||||
(defun ghc-sync-process (cmd)
|
(defun ghc-sync-process (cmd &optional n)
|
||||||
(setq ghc-process-rendezvous nil)
|
(setq ghc-process-rendezvous nil)
|
||||||
(setq ghc-process-results nil)
|
(setq ghc-process-results nil)
|
||||||
|
(setq ghc-process-num-of-results (or n 1))
|
||||||
(ghc-with-process cmd 'ghc-process-callback)
|
(ghc-with-process cmd 'ghc-process-callback)
|
||||||
(while (null ghc-process-rendezvous)
|
(while (null ghc-process-rendezvous)
|
||||||
(sit-for 0.01))
|
(sit-for 0.01))
|
||||||
ghc-process-results)
|
ghc-process-results)
|
||||||
|
|
||||||
(defun ghc-process-callback ()
|
(defun ghc-process-callback ()
|
||||||
(let ((mods (ghc-read-lisp-this-buffer)))
|
(let* ((n ghc-process-num-of-results)
|
||||||
(setq ghc-process-results mods)
|
(ret (if (= n 1)
|
||||||
|
(ghc-read-lisp-this-buffer)
|
||||||
|
(ghc-read-lisp-list-this-buffer n))))
|
||||||
|
(setq ghc-process-results ret)
|
||||||
|
(setq ghc-process-num-of-results nil)
|
||||||
(setq ghc-process-rendezvous t)))
|
(setq ghc-process-rendezvous t)))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
(define-key haskell-mode-map ghc-deeper-key 'ghc-make-indent-deeper)
|
(define-key haskell-mode-map ghc-deeper-key 'ghc-make-indent-deeper)
|
||||||
(ghc-comp-init)
|
(ghc-comp-init)
|
||||||
(setq ghc-initialized t))
|
(setq ghc-initialized t))
|
||||||
|
(ghc-import-module)
|
||||||
(ghc-check-syntax))
|
(ghc-check-syntax))
|
||||||
|
|
||||||
(defun ghc-abbrev-init ()
|
(defun ghc-abbrev-init ()
|
||||||
|
Loading…
Reference in New Issue
Block a user