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"))
|
(lambda () (call-process ghc-module-command nil t nil "-l" "boot"))
|
||||||
(length syms))))
|
(length syms))))
|
||||||
(ghc-set syms vals))
|
(ghc-set syms vals))
|
||||||
(add-to-list 'ghc-module-names "qualified")
|
(ghc-add ghc-module-names "qualified")
|
||||||
(add-to-list 'ghc-module-names "hiding")
|
(ghc-add ghc-module-names "hiding")
|
||||||
(add-to-list 'ghc-language-extensions "LANGUAGE")
|
(ghc-add 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))
|
||||||
@ -190,7 +190,7 @@
|
|||||||
(let ((keywords (ghc-load-keyword "browse" mod)))
|
(let ((keywords (ghc-load-keyword "browse" mod)))
|
||||||
(when (or (consp keywords) (null keywords))
|
(when (or (consp keywords) (null keywords))
|
||||||
(set (intern (concat ghc-keyword-prefix mod)) 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 ()
|
(defun ghc-merge-keywords ()
|
||||||
(let* ((modkeys (mapcar 'ghc-module-keyword ghc-loaded-module))
|
(let* ((modkeys (mapcar 'ghc-module-keyword ghc-loaded-module))
|
||||||
@ -212,7 +212,7 @@
|
|||||||
(dolist (buf bufs)
|
(dolist (buf bufs)
|
||||||
(when (string-match "\\.hs$" buf)
|
(when (string-match "\\.hs$" buf)
|
||||||
(set-buffer 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)))
|
(ghc-uniq-lol ret)))
|
||||||
|
|
||||||
(defun ghc-gather-import-modules-buffer ()
|
(defun ghc-gather-import-modules-buffer ()
|
||||||
@ -220,7 +220,7 @@
|
|||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "^import *\\([^\n ]+\\)" nil t)
|
(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)))
|
(forward-line)))
|
||||||
ret))
|
ret))
|
||||||
|
|
||||||
|
@ -58,4 +58,16 @@
|
|||||||
(make-sparse-keymap)))
|
(make-sparse-keymap)))
|
||||||
(define-key ghc-input-map "\t" 'ghc-complete))
|
(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)
|
(provide 'ghc-doc)
|
@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(defvar ghc-module-command "ghc-mod")
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun ghc-replace-character (string from to)
|
(defun ghc-replace-character (string from to)
|
||||||
"Replace characters equal to FROM to TO in STRING."
|
"Replace characters equal to FROM to TO in STRING."
|
||||||
(let ((ret (copy-sequence string)))
|
(let ((ret (copy-sequence string)))
|
||||||
@ -15,6 +19,18 @@
|
|||||||
(if (char-equal (aref ret cnt) from)
|
(if (char-equal (aref ret cnt) from)
|
||||||
(aset ret cnt to)))))
|
(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)
|
(defun ghc-which (cmd)
|
||||||
(catch 'loop
|
(catch 'loop
|
||||||
(dolist (suffix '("" ".exe"))
|
(dolist (suffix '("" ".exe"))
|
||||||
@ -24,15 +40,19 @@
|
|||||||
(if (file-exists-p path)
|
(if (file-exists-p path)
|
||||||
(throw 'loop path))))))))
|
(throw 'loop path))))))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun ghc-uniq-lol (lol)
|
(defun ghc-uniq-lol (lol)
|
||||||
(let ((hash (make-hash-table :test 'equal))
|
(let ((hash (make-hash-table :test 'equal))
|
||||||
ret)
|
ret)
|
||||||
(dolist (lst lol)
|
(dolist (lst lol)
|
||||||
(dolist (key lst)
|
(dolist (key lst)
|
||||||
(puthash key key hash)))
|
(puthash key key hash)))
|
||||||
(maphash (lambda (key val) (setq ret (cons key ret))) hash)
|
(maphash (lambda (key val) (ghc-add ret key)) hash)
|
||||||
ret))
|
ret))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun ghc-read-lisp (func)
|
(defun ghc-read-lisp (func)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(funcall func)
|
(funcall func)
|
||||||
@ -49,27 +69,8 @@
|
|||||||
(let ((m (set-marker (make-marker) 1 (current-buffer)))
|
(let ((m (set-marker (make-marker) 1 (current-buffer)))
|
||||||
ret)
|
ret)
|
||||||
(dotimes (i n)
|
(dotimes (i n)
|
||||||
(setq ret (cons (read m) ret)))
|
(ghc-add ret (read m)))
|
||||||
(nreverse ret))
|
(nreverse ret))
|
||||||
(error ()))))
|
(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)
|
(provide 'ghc-func)
|
||||||
|
Loading…
Reference in New Issue
Block a user