ghc-mod 3.1.6 → 3.1.7
raw patch · 10 files changed
+60/−36 lines, 10 filesdep ~hlint
Dependency ranges changed: hlint
Files
- Language/Haskell/GhcMod/Lint.hs +1/−1
- elisp/ghc-comp.el +14/−12
- elisp/ghc-doc.el +2/−2
- elisp/ghc-flymake.el +2/−2
- elisp/ghc-func.el +30/−7
- elisp/ghc-info.el +5/−5
- elisp/ghc-ins-mod.el +2/−3
- elisp/ghc.el +1/−1
- ghc-mod.cabal +2/−2
- test/LintSpec.hs +1/−1
Language/Haskell/GhcMod/Lint.hs view
@@ -18,4 +18,4 @@ lint :: Options -> FilePath -- ^ A target file. -> IO [String]-lint opt file = map show <$> hlint ([file, "--quiet"] ++ hlintOpts opt)+lint opt file = map show <$> hlint ([file] ++ hlintOpts opt)
elisp/ghc-comp.el view
@@ -96,25 +96,27 @@ ;;; (defun ghc-boot (n)- (if (not (executable-find ghc-module-command))- (message "%s not found" ghc-module-command)+ (ghc-executable-find ghc-module-command (ghc-read-lisp-list (lambda () (message "Initializing...")- (call-process ghc-module-command nil t nil "-l" "boot")+ (ghc-call-process ghc-module-command nil t nil "-l" "boot") (message "Initializing...done")) n))) (defun ghc-load-modules (mods)- (if (not (executable-find ghc-module-command))- (message "%s not found" ghc-module-command)- (ghc-read-lisp-list- (lambda ()- (message "Loading names...")- (apply 'call-process ghc-module-command nil '(t nil) nil- `(,@(ghc-make-ghc-options) "-l" "browse" ,@mods))- (message "Loading names...done"))- (length mods))))+ (if (null mods)+ (progn+ (message "No new modules")+ nil)+ (ghc-executable-find ghc-module-command+ (ghc-read-lisp-list+ (lambda ()+ (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))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;
elisp/ghc-doc.el view
@@ -34,7 +34,7 @@ (defun ghc-resolve-package-name (mod) (with-temp-buffer- (call-process "ghc-pkg" nil t nil "find-module" "--simple-output" mod)+ (ghc-call-process "ghc-pkg" nil t nil "find-module" "--simple-output" mod) (goto-char (point-min)) (when (re-search-forward "\\([^ ]+\\)-\\([0-9]*\\(\\.[0-9]+\\)*\\)$" nil t) (ghc-make-pkg-ver@@ -43,7 +43,7 @@ (defun ghc-resolve-document-path (pkg) (with-temp-buffer- (call-process "ghc-pkg" nil t nil "field" pkg "haddock-html")+ (ghc-call-process "ghc-pkg" nil t nil "field" pkg "haddock-html") (goto-char (point-max)) (forward-line -1) (beginning-of-line)
elisp/ghc-flymake.el view
@@ -20,7 +20,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defconst ghc-flymake-allowed-file-name-masks- '("\\.l?hs$" ghc-flymake-init nil ghc-emacs23-larter-hack))+ '("\\.l?hs$" ghc-flymake-init nil ghc-emacs23-later-hack)) (defconst ghc-flymake-err-line-patterns '("^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\):[ ]*\\(.+\\)" 1 2 3 4))@@ -33,7 +33,7 @@ ;; flymake of Emacs 23 or later does not display errors ;; if they occurred in other files. So, let's cheat flymake.-(defun ghc-emacs23-larter-hack (tmp-file)+(defun ghc-emacs23-later-hack (tmp-file) (let ((real-name (flymake-get-real-file-name tmp-file)) (hack-name (flymake-get-real-file-name buffer-file-name))) (unless (string= real-name hack-name)
elisp/ghc-func.el view
@@ -162,16 +162,39 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun ghc-run-ghc-mod (cmds)- (cond- ((executable-find ghc-module-command)+ (ghc-executable-find ghc-module-command (let ((cdir default-directory)) (with-temp-buffer (cd cdir)- (apply 'call-process ghc-module-command nil t nil+ (apply 'ghc-call-process ghc-module-command nil t nil (append (ghc-make-ghc-options) cmds))- (buffer-substring (point-min) (1- (point-max))))))- (t- (message "%s not found" ghc-module-command)- nil)))+ (buffer-substring (point-min) (1- (point-max)))))))++(defmacro ghc-executable-find (cmd &rest body)+ ;; (declare (indent 1))+ `(if (not (executable-find ,cmd))+ (message "\"%s\" not found" ,cmd)+ ,@body))++(put 'ghc-executable-find 'lisp-indent-function 1)++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;++(defvar ghc-debug nil)++(defvar ghc-debug-buffer "*GHC Debug*")++(defmacro ghc-with-debug-buffer (&rest body)+ `(with-current-buffer (set-buffer (get-buffer-create ghc-debug-buffer))+ (goto-char (point-max))+ ,@body))++(defun ghc-call-process (cmd x y z &rest args)+ (apply 'call-process cmd x y z args)+ (when ghc-debug+ (let ((cbuf (current-buffer)))+ (ghc-with-debug-buffer+ (insert (format "%% %s %s\n" cmd (mapconcat 'identity args " ")))+ (insert-buffer-substring cbuf))))) (provide 'ghc-func)
elisp/ghc-info.el view
@@ -77,8 +77,7 @@ (defun ghc-show-type () (interactive)- (if (not (executable-find ghc-module-command))- (message "%s not found" ghc-module-command)+ (ghc-executable-find ghc-module-command (let ((modname (or (ghc-find-module-name) "Main"))) (ghc-show-type0 modname)))) @@ -107,7 +106,7 @@ (let ((types (ghc-type-obtain-tinfos modname))) (if (not (listp types)) ;; main does not exist in Main (ghc-type-set-types nil)- (ghc-type-set-types (ghc-type-obtain-tinfos modname))+ (ghc-type-set-types types) (ghc-type-set-point (point)) (ghc-type-set-ix 0)))) (ghc-type-get-types))@@ -120,7 +119,7 @@ (ghc-read-lisp (lambda () (cd cdir)- (apply 'call-process ghc-module-command nil t nil+ (apply 'ghc-call-process ghc-module-command nil t nil `(,@(ghc-make-ghc-options) "-l" "type" ,file ,modname ,ln ,cn)) (goto-char (point-min)) (while (search-forward "[Char]" nil t)@@ -149,7 +148,8 @@ (defun ghc-get-pos (buf line col) (save-excursion (set-buffer buf)- (goto-line line)+ (goto-char (point-min))+ (forward-line (1- line)) (forward-char col) (point)))
elisp/ghc-ins-mod.el view
@@ -12,8 +12,7 @@ (defun ghc-insert-module () (interactive)- (if (not (executable-find ghc-hoogle-command))- (message "\"%s\" not found" ghc-hoogle-command)+ (ghc-executable-find ghc-hoogle-command (let* ((expr0 (ghc-things-at-point)) (expr (ghc-read-expression expr0))) (let ((mods (ghc-function-to-modules expr)))@@ -54,7 +53,7 @@ (concat "(" fn ")"))) (regex (concat "^\\([a-zA-Z0-9.]+\\) " fn1 " ")) ret)- (call-process ghc-hoogle-command nil t nil "search" fn1)+ (ghc-call-process ghc-hoogle-command nil t nil "search" fn1) (goto-char (point-min)) (while (re-search-forward regex nil t) (setq ret (cons (match-string 1) ret)))
elisp/ghc.el view
@@ -13,7 +13,7 @@ ;;; Code: -(defconst ghc-version "2.0.0")+(defconst ghc-version "3.1.7") ;; (eval-when-compile ;; (require 'haskell-mode))
ghc-mod.cabal view
@@ -1,5 +1,5 @@ Name: ghc-mod-Version: 3.1.6+Version: 3.1.7 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3@@ -68,7 +68,7 @@ , ghc , ghc-paths , ghc-syb-utils- , hlint >= 1.7.1+ , hlint >= 1.8.58 , io-choice , old-time , process
test/LintSpec.hs view
@@ -6,7 +6,7 @@ spec :: Spec spec = do describe "lintSyntax" $ do- it "check syntax with HList" $ do+ it "check syntax with HLint" $ do res <- lintSyntax defaultOptions "test/data/hlint.hs" res `shouldBe` "test/data/hlint.hs:4:8: Error: Redundant do\NULFound:\NUL do putStrLn \"Hello, world!\"\NULWhy not:\NUL putStrLn \"Hello, world!\"\n"