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)
(defun ghc-comp-init ()
(setq ghc-module-names (cons "hiding" (cons "qualified" (ghc-load-keyword "list"))))
(setq ghc-language-extensions (cons "LANGUAGE" (ghc-load-keyword "lang")))
(setq ghc-keyword-Prelude (ghc-load-keyword "browse" "Prelude"))
(let* ((syms '(ghc-module-names
ghc-language-extensions
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"))
(ghc-merge-keywords)
(run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer))

View File

@ -41,6 +41,18 @@
(read (current-buffer))
(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 ()
(interactive)
(save-excursion
@ -51,10 +63,10 @@
(defun ghc-read-module-name (def)
(read-from-minibuffer "Module name: " def ghc-input-map))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst ghc-null 0)
(defconst ghc-newline 10)
(defun ghc-set (vars vals)
(dolist (var vars)
(if var (set var (car vals))) ;; var can be nil to skip
(setq vals (cdr vals))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;