diff --git a/elisp/ghc-command.el b/elisp/ghc-command.el index e62cb77..18cc572 100644 --- a/elisp/ghc-command.el +++ b/elisp/ghc-command.el @@ -15,12 +15,12 @@ (cond ((bobp) (ghc-insert-module-template)) + ((ghc-flymake-have-errs-p) + (ghc-flymake-insert-from-warning)) ((save-excursion (beginning-of-line) (looking-at "^[^ ]+ *::")) (ghc-insert-function-template)) - ((ghc-flymake-have-errs-p) - (ghc-flymake-insert-from-warning)) (t (message "Nothing to be done")))) diff --git a/elisp/ghc-flymake.el b/elisp/ghc-flymake.el index 03e9959..e59ec86 100644 --- a/elisp/ghc-flymake.el +++ b/elisp/ghc-flymake.el @@ -89,7 +89,16 @@ (unless (re-search-forward "^$" nil t) (goto-char (point-max)) (insert "\n"))) - (insert "\n" (match-string 1 data) " = undefined\n")))))) + (insert "\n" (match-string 1 data) " = undefined\n")) + ((string-match "Found:\0[ ]*\\([^\0]+\\)\0Why not:\0[ ]*\\([^\0]+\\)" data) + (let ((old (match-string 1 data)) + (new (match-string 2 data))) + (beginning-of-line) + (when (search-forward old nil t) + (let ((end (point))) + (search-backward old nil t) + (delete-region (point) end)) + (insert new)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;