ok/ng hack.
This commit is contained in:
parent
ee6dc2fc47
commit
ebc1499d13
@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;; other files' errors should go to 0
|
;; templates
|
||||||
;; ghc-flymake-jump
|
;; ghc-flymake-jump
|
||||||
|
;; multiple Main in the same directory
|
||||||
|
|
||||||
(require 'ghc-func)
|
(require 'ghc-func)
|
||||||
|
|
||||||
@ -68,11 +69,7 @@
|
|||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(insert string)
|
(insert string)
|
||||||
(forward-line -1)
|
(forward-line -1)
|
||||||
(cond
|
(when (looking-at "^\\(OK\\|NG\\)$")
|
||||||
((looking-at "^NG$")
|
|
||||||
(setq ghc-check-running nil)
|
|
||||||
(message "An error happens"))
|
|
||||||
((looking-at "^OK$")
|
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((regex "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): *\\(.+\\)")
|
(let ((regex "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): *\\(.+\\)")
|
||||||
info infos)
|
info infos)
|
||||||
@ -86,18 +83,18 @@
|
|||||||
(setq infos (nreverse infos))
|
(setq infos (nreverse infos))
|
||||||
(cond
|
(cond
|
||||||
(infos
|
(infos
|
||||||
(ghc-check-highlight-original-buffer ghc-check-original-buffer infos))
|
(let ((file ghc-check-original-file)
|
||||||
|
(buf ghc-check-original-buffer))
|
||||||
|
(ghc-check-highlight-original-buffer file buf infos)))
|
||||||
(t
|
(t
|
||||||
(with-current-buffer ghc-check-original-buffer
|
(with-current-buffer ghc-check-original-buffer
|
||||||
(remove-overlays (point-min) (point-max) 'ghc-check t))
|
(remove-overlays (point-min) (point-max) 'ghc-check t))))
|
||||||
;; fixme no changes
|
(setq ghc-check-running nil)))))
|
||||||
))
|
|
||||||
(setq ghc-check-running nil))))))
|
|
||||||
|
|
||||||
(defun ghc-check-process-sentinel (process event)
|
(defun ghc-check-process-sentinel (process event)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defun ghc-check-highlight-original-buffer (buf infos)
|
(defun ghc-check-highlight-original-buffer (ofile buf infos)
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
(remove-overlays (point-min) (point-max) 'ghc-check t)
|
(remove-overlays (point-min) (point-max) 'ghc-check t)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
@ -105,17 +102,25 @@
|
|||||||
(dolist (info infos)
|
(dolist (info infos)
|
||||||
(let ((line (ghc-hilit-info-get-line info))
|
(let ((line (ghc-hilit-info-get-line info))
|
||||||
(msg (ghc-hilit-info-get-msg info))
|
(msg (ghc-hilit-info-get-msg info))
|
||||||
|
(file (ghc-hilit-info-get-file info))
|
||||||
beg end ovl)
|
beg end ovl)
|
||||||
;; FIXME: This is the Shlemiel painter's algorithm.
|
;; FIXME: This is the Shlemiel painter's algorithm.
|
||||||
;; If this is a bottleneck for a large code, let's fix.
|
;; If this is a bottleneck for a large code, let's fix.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(forward-line (1- line))
|
(cond
|
||||||
(while (eq (char-after) 32) (forward-char))
|
((string= ofile file)
|
||||||
(setq beg (point))
|
(forward-line (1- line))
|
||||||
(forward-line)
|
(while (eq (char-after) 32) (forward-char))
|
||||||
(setq end (1- (point)))
|
(setq beg (point))
|
||||||
|
(forward-line)
|
||||||
|
(setq end (1- (point))))
|
||||||
|
(t
|
||||||
|
(setq beg (point))
|
||||||
|
(forward-line)
|
||||||
|
(setq end (point))))
|
||||||
(setq ovl (make-overlay beg end))
|
(setq ovl (make-overlay beg end))
|
||||||
(overlay-put ovl 'ghc-check t)
|
(overlay-put ovl 'ghc-check t)
|
||||||
|
(overlay-put ovl 'ghc-file file)
|
||||||
(overlay-put ovl 'ghc-msg msg) ;; should be list
|
(overlay-put ovl 'ghc-msg msg) ;; should be list
|
||||||
(let ((face (if (string-match "^Error" msg)
|
(let ((face (if (string-match "^Error" msg)
|
||||||
'ghc-face-error
|
'ghc-face-error
|
||||||
@ -150,7 +155,7 @@
|
|||||||
(ghc-display
|
(ghc-display
|
||||||
nil
|
nil
|
||||||
(lambda ()
|
(lambda ()
|
||||||
;; (insert title "\n\n")
|
(insert (overlay-get (car ovls) 'ghc-file) "\n\n")
|
||||||
(mapc (lambda (x) (insert x "\n")) errs))))))
|
(mapc (lambda (x) (insert x "\n")) errs))))))
|
||||||
|
|
||||||
(defun ghc-check-overlay-at (p)
|
(defun ghc-check-overlay-at (p)
|
||||||
@ -164,9 +169,8 @@
|
|||||||
(end (if ovls0 (overlay-start (car ovls0)) here))
|
(end (if ovls0 (overlay-start (car ovls0)) here))
|
||||||
(ovls1 (overlays-in (point-min) end))
|
(ovls1 (overlays-in (point-min) end))
|
||||||
(ovls2 (ghc-filter (lambda (ovl) (overlay-get ovl 'ghc-check)) ovls1))
|
(ovls2 (ghc-filter (lambda (ovl) (overlay-get ovl 'ghc-check)) ovls1))
|
||||||
(pnts0 (mapcar 'overlay-start ovls2))
|
(pnts (mapcar 'overlay-start ovls2)))
|
||||||
(pnts1 (sort pnts0 '>)))
|
(if pnts (goto-char (apply 'max pnts)))))
|
||||||
(if pnts1 (goto-char (car pnts1)))))
|
|
||||||
|
|
||||||
(defun ghc-goto-next-error ()
|
(defun ghc-goto-next-error ()
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -175,8 +179,7 @@
|
|||||||
(beg (if ovls0 (overlay-end (car ovls0)) here))
|
(beg (if ovls0 (overlay-end (car ovls0)) here))
|
||||||
(ovls1 (overlays-in beg (point-max)))
|
(ovls1 (overlays-in beg (point-max)))
|
||||||
(ovls2 (ghc-filter (lambda (ovl) (overlay-get ovl 'ghc-check)) ovls1))
|
(ovls2 (ghc-filter (lambda (ovl) (overlay-get ovl 'ghc-check)) ovls1))
|
||||||
(pnts0 (mapcar 'overlay-start ovls2))
|
(pnts (mapcar 'overlay-start ovls2)))
|
||||||
(pnts1 (sort pnts0 '<)))
|
(if pnts (goto-char (apply 'min pnts)))))
|
||||||
(if pnts1 (goto-char (car pnts1)))))
|
|
||||||
|
|
||||||
(provide 'ghc-check)
|
(provide 'ghc-check)
|
||||||
|
Loading…
Reference in New Issue
Block a user