bug fix: show source function in minor errors
This commit is contained in:
parent
af1b8e5d57
commit
fbe13a46b1
29
notibox.el
29
notibox.el
@ -133,7 +133,8 @@ If STACKDEPTH is non-nil and nonzero, return a position that far down."
|
||||
|
||||
(defun notibox--hide (frame)
|
||||
"Stop showing FRAME."
|
||||
(posframe-hide (window-buffer (frame-selected-window frame))))
|
||||
(if (frame-live-p frame)
|
||||
(posframe-hide (window-buffer (frame-selected-window frame)))))
|
||||
|
||||
(defun notibox-delete (frame)
|
||||
"Delete the notibox FRAME.
|
||||
@ -157,32 +158,44 @@ If the source is not obvious, use `current-buffer'."
|
||||
contents
|
||||
(splooted (split-string msg ": ")))
|
||||
(pcase (length splooted)
|
||||
(2 (progn
|
||||
(setq source (car splooted))
|
||||
(setq contents (cadr splooted))))
|
||||
;; problem: the echo area shows only cdr, whereas messages buffer shows the source fn we want..
|
||||
(1 (progn
|
||||
(setq source
|
||||
(format "%s"
|
||||
(current-buffer)))
|
||||
(setq contents
|
||||
(car splooted))))
|
||||
(2 (progn
|
||||
(setq source (car splooted))
|
||||
(setq contents (cadr splooted))))
|
||||
)
|
||||
;; (message "[debug] message: %s" msg)
|
||||
(cons source contents)))
|
||||
;; (split-string "evil-forward-character: End of line" ": ")
|
||||
;; (length '("evil-forward-character" "end of line"))
|
||||
;; (split-string "this is a valid message" ": ")
|
||||
;; (notibox--parse-message "evil-forward-char: End of line")
|
||||
;; (notibox--parse-message "this is a badly formed message")
|
||||
(defun buflast (buffer)
|
||||
"Return the last line of BUFFER as a string, without linebreaks."
|
||||
(with-current-buffer buffer
|
||||
(save-excursion
|
||||
(goto-char (- (point-max) 1)) ; there is a \n at the end of every buffer
|
||||
(buffer-substring-no-properties (point-at-bol) (point-max)))))
|
||||
;; (buflast (get-buffer "*Messages*"))
|
||||
|
||||
(defun notibox--tail-echoarea ()
|
||||
"Show `current-message' in the notibox. If that does not exist, probably hide it."
|
||||
(if (current-message)
|
||||
(let* ((notibox-border-color "#0faa0f")
|
||||
(let* ((notibox-border-color "#0faa0f") ; hacky, can we set it elsewhere?
|
||||
(parsed-msg
|
||||
(notibox--parse-message (current-message)))
|
||||
(notibox--parse-message
|
||||
;; (current-message)
|
||||
(buflast (get-buffer "*Messages*")) ; workaround for abbreviated stuff
|
||||
))
|
||||
(title (car parsed-msg))
|
||||
(contents (cdr parsed-msg)))
|
||||
(notibox-alert `(
|
||||
:title ,title
|
||||
(notibox-alert `( :title ,title
|
||||
:message ,contents
|
||||
:depth 0)))
|
||||
(if notibox-current-posframes
|
||||
|
Loading…
Reference in New Issue
Block a user