Skip to content

Commit e7e24a6

Browse files
committed
overlays: put a brief overlay summary into the modeline
1 parent 94e35ec commit e7e24a6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

haskell-load.el

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,23 @@ actual Emacs buffer of the module being loaded."
317317
(let ((ovls (cl-remove-if-not test (overlays-in beg end))))
318318
(cl-first (sort (cl-copy-list ovls) 'overlay-start>))))
319319

320+
(defun string/starts-with (string prefix)
321+
"Return t if STRING starts with prefix."
322+
(and (string-match (rx-to-string `(: bos ,prefix) t)
323+
string)
324+
t))
325+
326+
(defun haskell-error-overlay-briefly (ovl)
327+
(let ((text (overlay-get ovl 'haskell-msg))
328+
(type (overlay-get ovl 'haskell-msg-type)))
329+
(if (eq type 'warning)
330+
(cl-subseq text 13)
331+
text)))
332+
320333
(defun haskell-goto-error-overlay (ovl)
321334
(cond (ovl
322-
(goto-char (overlay-start ovl)))
335+
(goto-char (overlay-start ovl))
336+
(haskell-mode-message-line (haskell-error-overlay-briefly ovl)))
323337
(t
324338
(message "No further notes from Haskell compiler."))))
325339

@@ -362,6 +376,7 @@ actual Emacs buffer of the module being loaded."
362376
(overlay-put ovl 'haskell-check t)
363377
(overlay-put ovl 'haskell-file file)
364378
(overlay-put ovl 'haskell-msg msg)
379+
(overlay-put ovl 'haskell-msg-type type)
365380
(overlay-put ovl 'help-echo msg)
366381
(overlay-put ovl 'haskell-hole hole)
367382
(cl-destructuring-bind (face fringe) (cl-case type

0 commit comments

Comments
 (0)