making case-split work even if the target is highlighted.

This commit is contained in:
Kazu Yamamoto 2014-08-20 14:44:24 +09:00
parent 51710c38b0
commit 607919e815
2 changed files with 50 additions and 48 deletions

View File

@ -366,7 +366,8 @@ nil does not display errors/warnings.
(defun ghc-check-insert-from-warning ()
(interactive)
(dolist (data (mapcar (lambda (ovl) (overlay-get ovl 'ghc-msg)) (ghc-check-overlay-at (point))))
(let ((ret t))
(dolist (data (mapcar (lambda (ovl) (overlay-get ovl 'ghc-msg)) (ghc-check-overlay-at (point))) ret)
(save-excursion
(cond
((string-match "Inferred type: \\|no type signature:" data)
@ -410,7 +411,7 @@ nil does not display errors/warnings.
(new (match-string 2 data)))
(ghc-check-replace old new)))
(t
(message "Nothing was done"))))))
(setq ret nil)))))))
(defun ghc-check-replace (old new)
(beginning-of-line)

View File

@ -17,9 +17,10 @@
((bobp)
(ghc-insert-module-template))
((ghc-check-overlay-at (point))
(ghc-check-insert-from-warning))
(or (ghc-check-insert-from-warning)
(ghc-try-case-split)))
(t
(when (null (ghc-try-case-split))
(unless (ghc-try-case-split)
(message "Nothing to be done")))))
(defun ghc-insert-module-template ()