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 () (defun ghc-check-insert-from-warning ()
(interactive) (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 (save-excursion
(cond (cond
((string-match "Inferred type: \\|no type signature:" data) ((string-match "Inferred type: \\|no type signature:" data)
@ -410,7 +411,7 @@ nil does not display errors/warnings.
(new (match-string 2 data))) (new (match-string 2 data)))
(ghc-check-replace old new))) (ghc-check-replace old new)))
(t (t
(message "Nothing was done")))))) (setq ret nil)))))))
(defun ghc-check-replace (old new) (defun ghc-check-replace (old new)
(beginning-of-line) (beginning-of-line)

View File

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