cosmetic change.
This commit is contained in:
parent
86e398ac92
commit
c4979bd04f
@ -54,9 +54,9 @@
|
||||
(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")
|
||||
(ghc-add ghc-module-names "qualified")
|
||||
(ghc-add ghc-module-names "hiding")
|
||||
(ghc-add ghc-language-extensions "LANGUAGE")
|
||||
(setq ghc-loaded-module '("Prelude"))
|
||||
(ghc-merge-keywords)
|
||||
(run-with-idle-timer ghc-idle-timer-interval 'repeat 'ghc-idle-timer))
|
||||
@ -190,7 +190,7 @@
|
||||
(let ((keywords (ghc-load-keyword "browse" mod)))
|
||||
(when (or (consp keywords) (null keywords))
|
||||
(set (intern (concat ghc-keyword-prefix mod)) keywords)
|
||||
(setq ghc-loaded-module (cons mod ghc-loaded-module))))))
|
||||
(ghc-add ghc-loaded-module mod)))))
|
||||
|
||||
(defun ghc-merge-keywords ()
|
||||
(let* ((modkeys (mapcar 'ghc-module-keyword ghc-loaded-module))
|
||||
@ -212,7 +212,7 @@
|
||||
(dolist (buf bufs)
|
||||
(when (string-match "\\.hs$" buf)
|
||||
(set-buffer buf)
|
||||
(setq ret (cons (ghc-gather-import-modules-buffer) ret)))))
|
||||
(ghc-add ret (ghc-gather-import-modules-buffer)))))
|
||||
(ghc-uniq-lol ret)))
|
||||
|
||||
(defun ghc-gather-import-modules-buffer ()
|
||||
@ -220,7 +220,7 @@
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^import *\\([^\n ]+\\)" nil t)
|
||||
(setq ret (cons (match-string-no-properties 1) ret))
|
||||
(ghc-add ret (match-string-no-properties 1))
|
||||
(forward-line)))
|
||||
ret))
|
||||
|
||||
|
@ -58,4 +58,16 @@
|
||||
(make-sparse-keymap)))
|
||||
(define-key ghc-input-map "\t" 'ghc-complete))
|
||||
|
||||
(defun ghc-read-module-name (def)
|
||||
(read-from-minibuffer "Module name: " def ghc-input-map))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun ghc-extract-module ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(if (looking-at "^\\(import\\|module\\) +\\(qualified +\\)?\\([^ (\n]+\\)")
|
||||
(match-string-no-properties 3))))
|
||||
|
||||
(provide 'ghc-doc)
|
@ -8,6 +8,10 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar ghc-module-command "ghc-mod")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun ghc-replace-character (string from to)
|
||||
"Replace characters equal to FROM to TO in STRING."
|
||||
(let ((ret (copy-sequence string)))
|
||||
@ -15,6 +19,18 @@
|
||||
(if (char-equal (aref ret cnt) from)
|
||||
(aset ret cnt to)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defmacro ghc-add (sym val)
|
||||
`(setq ,sym (cons ,val ,sym)))
|
||||
|
||||
(defun ghc-set (vars vals)
|
||||
(dolist (var vars)
|
||||
(if var (set var (car vals))) ;; var can be nil to skip
|
||||
(setq vals (cdr vals))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun ghc-which (cmd)
|
||||
(catch 'loop
|
||||
(dolist (suffix '("" ".exe"))
|
||||
@ -24,15 +40,19 @@
|
||||
(if (file-exists-p path)
|
||||
(throw 'loop path))))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun ghc-uniq-lol (lol)
|
||||
(let ((hash (make-hash-table :test 'equal))
|
||||
ret)
|
||||
(dolist (lst lol)
|
||||
(dolist (key lst)
|
||||
(puthash key key hash)))
|
||||
(maphash (lambda (key val) (setq ret (cons key ret))) hash)
|
||||
(maphash (lambda (key val) (ghc-add ret key)) hash)
|
||||
ret))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun ghc-read-lisp (func)
|
||||
(with-temp-buffer
|
||||
(funcall func)
|
||||
@ -49,27 +69,8 @@
|
||||
(let ((m (set-marker (make-marker) 1 (current-buffer)))
|
||||
ret)
|
||||
(dotimes (i n)
|
||||
(setq ret (cons (read m) ret)))
|
||||
(ghc-add ret (read m)))
|
||||
(nreverse ret))
|
||||
(error ()))))
|
||||
|
||||
(defun ghc-extract-module ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(if (looking-at "^\\(import\\|module\\) +\\(qualified +\\)?\\([^ (\n]+\\)")
|
||||
(match-string-no-properties 3))))
|
||||
|
||||
(defun ghc-read-module-name (def)
|
||||
(read-from-minibuffer "Module name: " def ghc-input-map))
|
||||
|
||||
(defun ghc-set (vars vals)
|
||||
(dolist (var vars)
|
||||
(if var (set var (car vals))) ;; var can be nil to skip
|
||||
(setq vals (cdr vals))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar ghc-module-command "ghc-mod")
|
||||
|
||||
(provide 'ghc-func)
|
||||
|
Loading…
Reference in New Issue
Block a user