From 1b2437a60e9c589ae57c80b32fdeb2a108e29979 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 2 Mar 2012 21:36:58 +0900 Subject: [PATCH] reverting file path and C-cC-j. --- ErrMsg.hs | 3 +-- elisp/ghc-flymake.el | 20 +++++++++++++++++++- elisp/ghc.el | 2 ++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ErrMsg.hs b/ErrMsg.hs index 78dbee0..b2d2df2 100644 --- a/ErrMsg.hs +++ b/ErrMsg.hs @@ -14,7 +14,6 @@ import GHC import qualified Gap import HscTypes import Outputable -import System.FilePath ---------------------------------------------------------------- @@ -54,7 +53,7 @@ ppMsg :: SrcSpan -> Message -> PprStyle -> String ppMsg spn msg stl = fromMaybe def $ do (line,col,_,_) <- Gap.getSrcSpan spn file <- Gap.getSrcFile spn - return $ takeFileName file ++ ":" ++ show line ++ ":" ++ show col ++ ":" ++ cts ++ "\0" + return $ file ++ ":" ++ show line ++ ":" ++ show col ++ ":" ++ cts ++ "\0" where def = "ghc-mod:0:0:Probably mutual module import occurred\0" cts = showMsg msg stl diff --git a/elisp/ghc-flymake.el b/elisp/ghc-flymake.el index 89f80fe..70d0f73 100644 --- a/elisp/ghc-flymake.el +++ b/elisp/ghc-flymake.el @@ -77,6 +77,18 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun ghc-flymake-jump () + (interactive) + (if (not (ghc-flymake-have-errs-p)) + (message "No errors or warnings") + (let* ((acts (ghc-flymake-act-list)) + (act (car acts))) + (if (not act) + (message "No destination") + (eval act))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defun ghc-extract-type (str) (with-temp-buffer (insert str) @@ -166,6 +178,9 @@ (defun ghc-flymake-err-get-title (x) (nth 0 x)) (defun ghc-flymake-err-get-errs (x) (nth 1 x)) +(defun ghc-flymake-err-get-err-msg (x) (nth 0 x)) +(defun ghc-flymake-err-get-err-act (x) (nth 1 x)) + (defalias 'ghc-flymake-have-errs-p 'ghc-flymake-data) (defun ghc-flymake-data () @@ -177,6 +192,9 @@ (ghc-flymake-err-get-title (ghc-flymake-data))) (defun ghc-flymake-err-list () - (mapcar 'car (ghc-flymake-err-get-errs (ghc-flymake-data)))) + (mapcar 'ghc-flymake-err-get-err-msg (ghc-flymake-err-get-errs (ghc-flymake-data)))) + +(defun ghc-flymake-act-list () + (mapcar 'ghc-flymake-err-get-err-act (ghc-flymake-err-get-errs (ghc-flymake-data)))) (provide 'ghc-flymake) diff --git a/elisp/ghc.el b/elisp/ghc.el index ad83d60..4400401 100644 --- a/elisp/ghc.el +++ b/elisp/ghc.el @@ -54,6 +54,7 @@ (defvar ghc-toggle-key "\C-c\C-c") (defvar ghc-module-key "\C-c\C-m") (defvar ghc-expand-key "\C-c\C-e") +(defvar ghc-jump-key "\C-c\C-j") (defvar ghc-hoogle-key (format "\C-c%c" (ghc-find-C-h))) (defvar ghc-shallower-key "\C-c<") (defvar ghc-deeper-key "\C-c>") @@ -75,6 +76,7 @@ (define-key haskell-mode-map ghc-type-key 'ghc-show-type) (define-key haskell-mode-map ghc-info-key 'ghc-show-info) (define-key haskell-mode-map ghc-expand-key 'ghc-expand-th) + (define-key haskell-mode-map ghc-jump-key 'ghc-flymake-jump) (define-key haskell-mode-map ghc-import-key 'ghc-import-module) (define-key haskell-mode-map ghc-previous-key 'flymake-goto-prev-error) (define-key haskell-mode-map ghc-next-key 'flymake-goto-next-error)