From b3d9b1268831b68a72451cd8d4255e2f3b81ad11 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 25 Jun 2010 20:31:46 +0900 Subject: [PATCH] fixing a bug of func = undefined. --- elisp/ghc-command.el | 13 ------------- elisp/ghc-flymake.el | 9 ++++++++- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/elisp/ghc-command.el b/elisp/ghc-command.el index 18cc572..1db0e5d 100644 --- a/elisp/ghc-command.el +++ b/elisp/ghc-command.el @@ -17,10 +17,6 @@ (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)) (t (message "Nothing to be done")))) @@ -29,15 +25,6 @@ (let ((mod (file-name-sans-extension (buffer-name)))) (insert "module " mod " where\n"))) -(defun ghc-insert-function-template () - (save-excursion - (beginning-of-line) - (when (looking-at "^\\([^ ]+\\) *::") - (save-match-data - (forward-line) - (if (eobp) (insert "\n"))) - (insert (match-string 1) " = undefined\n")))) - (defun ghc-sort-lines (beg end) (interactive "r") (save-excursion diff --git a/elisp/ghc-flymake.el b/elisp/ghc-flymake.el index 096d68c..31951e5 100644 --- a/elisp/ghc-flymake.el +++ b/elisp/ghc-flymake.el @@ -72,7 +72,7 @@ (insert title "\n\n") (mapc (lambda (x) (insert (ghc-replace-character x ghc-null ghc-newline) "\n")) errs) (goto-char (point-min)) - (while (re-search-forward "In the [^:\n ]+: \\|Expected type: \\|Inferred type: \\|Possible fix: " nil t) + (while (re-search-forward "In the definition of [^:\n ]+: \\|In the [^:\n ]+: \\|Expected type: \\|Inferred type: \\|Possible fix: " nil t) (replace-match (concat "\n" (match-string 0) "\n "))) (goto-char (point-max)) (while (re-search-backward "In the [a-z]+ argument\\|In the `" nil t) @@ -90,6 +90,13 @@ (insert (match-string 1 data) (replace-regexp-in-string "\\[Char\\]" "String" (match-string 3 data)) "\n")) + ((string-match "lacks an accompanying binding" data) + (beginning-of-line) + (when (looking-at "^\\([^ ]+\\) *::") + (save-match-data + (forward-line) + (if (eobp) (insert "\n"))) + (insert (match-string 1) " = undefined\n"))) ((string-match "Not in scope: `\\([^']+\\)'" data) (save-match-data (unless (re-search-forward "^$" nil t)