removing unnecessary vars.

This commit is contained in:
Kazu Yamamoto 2010-05-04 12:49:22 +09:00
parent 6c5e5a55d9
commit 86e398ac92
2 changed files with 26 additions and 7 deletions

View File

@ -47,9 +47,16 @@
(defvar ghc-loaded-module nil) (defvar ghc-loaded-module nil)
(defun ghc-comp-init () (defun ghc-comp-init ()
(setq ghc-module-names (cons "hiding" (cons "qualified" (ghc-load-keyword "list")))) (let* ((syms '(ghc-module-names
(setq ghc-language-extensions (cons "LANGUAGE" (ghc-load-keyword "lang"))) ghc-language-extensions
(setq ghc-keyword-Prelude (ghc-load-keyword "browse" "Prelude")) ghc-keyword-Prelude))
(vals (ghc-read-lisp-list
(lambda () (call-process ghc-module-command nil t nil "-l" "boot"))
(length syms))))
(ghc-set syms vals))
(add-to-list 'ghc-module-names "qualified")
(add-to-list 'ghc-module-names "hiding")
(add-to-list 'ghc-language-extensions "LANGUAGE")
(setq ghc-loaded-module '("Prelude")) (setq ghc-loaded-module '("Prelude"))
(ghc-merge-keywords) (ghc-merge-keywords)
(run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer)) (run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer))

View File

@ -41,6 +41,18 @@
(read (current-buffer)) (read (current-buffer))
(error ())))) (error ()))))
(defun ghc-read-lisp-list (func n)
(with-temp-buffer
(funcall func)
(goto-char (point-min))
(condition-case nil
(let ((m (set-marker (make-marker) 1 (current-buffer)))
ret)
(dotimes (i n)
(setq ret (cons (read m) ret)))
(nreverse ret))
(error ()))))
(defun ghc-extract-module () (defun ghc-extract-module ()
(interactive) (interactive)
(save-excursion (save-excursion
@ -51,10 +63,10 @@
(defun ghc-read-module-name (def) (defun ghc-read-module-name (def)
(read-from-minibuffer "Module name: " def ghc-input-map)) (read-from-minibuffer "Module name: " def ghc-input-map))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun ghc-set (vars vals)
(dolist (var vars)
(defconst ghc-null 0) (if var (set var (car vals))) ;; var can be nil to skip
(defconst ghc-newline 10) (setq vals (cdr vals))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;