Hihlight only hole when found
This commit is contained in:
parent
ccb9980436
commit
f0c44e4850
@ -69,7 +69,7 @@ nil does not display errors/warnings.
|
|||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(ghc-defstruct hilit-info file line msg err hole)
|
(ghc-defstruct hilit-info file line msg err hole coln)
|
||||||
|
|
||||||
(defun ghc-check-send ()
|
(defun ghc-check-send ()
|
||||||
(let ((file (buffer-file-name)))
|
(let ((file (buffer-file-name)))
|
||||||
@ -119,13 +119,16 @@ nil does not display errors/warnings.
|
|||||||
(when (string-match regex err)
|
(when (string-match regex err)
|
||||||
(let* ((file (expand-file-name (match-string 1 err))) ;; for Windows
|
(let* ((file (expand-file-name (match-string 1 err))) ;; for Windows
|
||||||
(line (string-to-number (match-string 2 err)))
|
(line (string-to-number (match-string 2 err)))
|
||||||
;; don't take column to make multiple same errors to a single.
|
(coln (string-to-number (match-string 3 err)))
|
||||||
(msg (match-string 4 err))
|
(msg (match-string 4 err))
|
||||||
(wrn (string-match "^Warning" msg))
|
(wrn (string-match "^Warning" msg))
|
||||||
(hole (string-match "Found hole" msg))
|
(hole (save-match-data
|
||||||
|
(when (string-match "Found hole .\\(_[_[:alnum:]]*\\)." msg)
|
||||||
|
(message (match-string 1 msg)) (match-string 1 msg))))
|
||||||
(info (ghc-make-hilit-info
|
(info (ghc-make-hilit-info
|
||||||
:file file
|
:file file
|
||||||
:line line
|
:line line
|
||||||
|
:coln coln
|
||||||
:msg msg
|
:msg msg
|
||||||
:err (and (not wrn) (not hole))
|
:err (and (not wrn) (not hole))
|
||||||
:hole hole)))
|
:hole hole)))
|
||||||
@ -143,11 +146,18 @@ nil does not display errors/warnings.
|
|||||||
(file (ghc-hilit-info-get-file info))
|
(file (ghc-hilit-info-get-file info))
|
||||||
(err (ghc-hilit-info-get-err info))
|
(err (ghc-hilit-info-get-err info))
|
||||||
(hole (ghc-hilit-info-get-hole info))
|
(hole (ghc-hilit-info-get-hole info))
|
||||||
|
(coln (ghc-hilit-info-get-coln 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))
|
||||||
(cond
|
(cond
|
||||||
|
((and (string= ofile file) hole)
|
||||||
|
(forward-line (1- line))
|
||||||
|
(forward-char (1- coln))
|
||||||
|
(setq beg (point))
|
||||||
|
(forward-char (length hole))
|
||||||
|
(setq end (point)))
|
||||||
((string= ofile file)
|
((string= ofile file)
|
||||||
(forward-line (1- line))
|
(forward-line (1- line))
|
||||||
(while (eq (char-after) 32) (forward-char))
|
(while (eq (char-after) 32) (forward-char))
|
||||||
|
Loading…
Reference in New Issue
Block a user