display error message to minibuffer when goto next/prev error.
This commit is contained in:
parent
5ca0da14ec
commit
a5c62acec9
@ -144,6 +144,18 @@
|
|||||||
(insert (overlay-get (car ovls) 'ghc-file) "\n\n")
|
(insert (overlay-get (car ovls) 'ghc-file) "\n\n")
|
||||||
(mapc (lambda (x) (insert x "\n\n")) errs))))))
|
(mapc (lambda (x) (insert x "\n\n")) errs))))))
|
||||||
|
|
||||||
|
(defun ghc-display-errors-to-minibuf ()
|
||||||
|
(interactive)
|
||||||
|
(let* ((ovls (ghc-check-overlay-at (point)))
|
||||||
|
(errs (mapcar (lambda (ovl) (overlay-get ovl 'ghc-msg)) ovls))
|
||||||
|
(old-max-mini-window-height max-mini-window-height))
|
||||||
|
(setq max-mini-window-height 0.95)
|
||||||
|
(if (null ovls)
|
||||||
|
(message "No errors or warnings")
|
||||||
|
(progn
|
||||||
|
(message "%s\n" (mapconcat (lambda (x) (replace-regexp-in-string "\0" "\n" x)) errs "\n"))))
|
||||||
|
(setq old-max-mini-window-height)))
|
||||||
|
|
||||||
(defun ghc-check-overlay-at (p)
|
(defun ghc-check-overlay-at (p)
|
||||||
(let ((ovls (overlays-at p)))
|
(let ((ovls (overlays-at p)))
|
||||||
(ghc-filter (lambda (ovl) (overlay-get ovl 'ghc-check)) ovls)))
|
(ghc-filter (lambda (ovl) (overlay-get ovl 'ghc-check)) ovls)))
|
||||||
@ -160,6 +172,11 @@
|
|||||||
(pnts (mapcar 'overlay-start ovls2)))
|
(pnts (mapcar 'overlay-start ovls2)))
|
||||||
(if pnts (goto-char (apply 'max pnts)))))
|
(if pnts (goto-char (apply 'max pnts)))))
|
||||||
|
|
||||||
|
(defun ghc-goto-and-display-prev-error ()
|
||||||
|
(interactive)
|
||||||
|
(ghc-goto-prev-error)
|
||||||
|
(ghc-display-errors-to-minibuf))
|
||||||
|
|
||||||
(defun ghc-goto-next-error ()
|
(defun ghc-goto-next-error ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((here (point))
|
(let* ((here (point))
|
||||||
@ -170,6 +187,11 @@
|
|||||||
(pnts (mapcar 'overlay-start ovls2)))
|
(pnts (mapcar 'overlay-start ovls2)))
|
||||||
(if pnts (goto-char (apply 'min pnts)))))
|
(if pnts (goto-char (apply 'min pnts)))))
|
||||||
|
|
||||||
|
(defun ghc-goto-and-display-next-error ()
|
||||||
|
(interactive)
|
||||||
|
(ghc-goto-next-error)
|
||||||
|
(ghc-display-errors-to-minibuf))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun ghc-check-insert-from-warning ()
|
(defun ghc-check-insert-from-warning ()
|
||||||
|
17
elisp/ghc.el
17
elisp/ghc.el
@ -8,6 +8,14 @@
|
|||||||
;;
|
;;
|
||||||
;; (autoload 'ghc-init "ghc" nil t)
|
;; (autoload 'ghc-init "ghc" nil t)
|
||||||
;; (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
|
;; (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
|
||||||
|
;;
|
||||||
|
;; Or you wish to display error to minibuffer.
|
||||||
|
;;
|
||||||
|
;; (autoload 'ghc-init "ghc" nil t)
|
||||||
|
;; (setq ghc-display-error-to-minibuffer t)
|
||||||
|
;; (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
@ -56,6 +64,8 @@
|
|||||||
(defvar ghc-shallower-key "\C-c<")
|
(defvar ghc-shallower-key "\C-c<")
|
||||||
(defvar ghc-deeper-key "\C-c>")
|
(defvar ghc-deeper-key "\C-c>")
|
||||||
|
|
||||||
|
(defvar ghc-display-error-to-minibuffer nil)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;
|
;;;
|
||||||
;;; Initializer
|
;;; Initializer
|
||||||
@ -74,8 +84,13 @@
|
|||||||
(define-key haskell-mode-map ghc-info-key 'ghc-show-info)
|
(define-key haskell-mode-map ghc-info-key 'ghc-show-info)
|
||||||
(define-key haskell-mode-map ghc-expand-key 'ghc-expand-th)
|
(define-key haskell-mode-map ghc-expand-key 'ghc-expand-th)
|
||||||
(define-key haskell-mode-map ghc-import-key 'ghc-import-module)
|
(define-key haskell-mode-map ghc-import-key 'ghc-import-module)
|
||||||
|
(if ghc-display-error-to-minibuffer
|
||||||
|
(progn
|
||||||
|
(define-key haskell-mode-map ghc-previous-key 'ghc-goto-and-display-prev-error)
|
||||||
|
(define-key haskell-mode-map ghc-next-key 'ghc-goto-and-display-next-error))
|
||||||
|
(progn
|
||||||
(define-key haskell-mode-map ghc-previous-key 'ghc-goto-prev-error)
|
(define-key haskell-mode-map ghc-previous-key 'ghc-goto-prev-error)
|
||||||
(define-key haskell-mode-map ghc-next-key 'ghc-goto-next-error)
|
(define-key haskell-mode-map ghc-next-key 'ghc-goto-next-error)))
|
||||||
(define-key haskell-mode-map ghc-help-key 'ghc-display-errors)
|
(define-key haskell-mode-map ghc-help-key 'ghc-display-errors)
|
||||||
(define-key haskell-mode-map ghc-insert-key 'ghc-insert-template)
|
(define-key haskell-mode-map ghc-insert-key 'ghc-insert-template)
|
||||||
(define-key haskell-mode-map ghc-sort-key 'ghc-sort-lines)
|
(define-key haskell-mode-map ghc-sort-key 'ghc-sort-lines)
|
||||||
|
Loading…
Reference in New Issue
Block a user