Change tooltip stuff
This commit is contained in:
@@ -1302,13 +1302,28 @@ display."
|
|||||||
(posframe-hide name))
|
(posframe-hide name))
|
||||||
(posframe-hide name))))
|
(posframe-hide name))))
|
||||||
|
|
||||||
(defun my/floating-tooltip (name msg)
|
(defun my/-floating-tooltip-fill-string (msg &optional width prefix)
|
||||||
|
"Fill MSG to WIDTH, defaulting to 80 characters.
|
||||||
|
If PREFIX is a number, add that many spaces before each continuation line. If
|
||||||
|
it is a string, add that string. If it is nil, add 5 spaces."
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert msg)
|
||||||
|
(let ((fill-column (or width 80))
|
||||||
|
(fill-prefix (if (natnump prefix)
|
||||||
|
(make-string prefix ? )
|
||||||
|
prefix)))
|
||||||
|
(fill-region (point-min) (point-max)))
|
||||||
|
(buffer-string)))
|
||||||
|
|
||||||
|
(defun my/floating-tooltip (name msg &optional width prefix)
|
||||||
"If `display-graphic-p', call `my/posframe-tip', otherwise `popup-tip'.
|
"If `display-graphic-p', call `my/posframe-tip', otherwise `popup-tip'.
|
||||||
MSG is the message to show in the popup. NAME is the name of the buffer to pass
|
MSG is the message to show in the popup. NAME is the name of the buffer to pass
|
||||||
to `posframe-show' if the display is graphical."
|
to `posframe-show' if the display is graphical.
|
||||||
(if (display-graphic-p)
|
WIDTH and PREFIX are as for `my/-floating-tooltip-fill-string'."
|
||||||
(my/posframe-tip name msg)
|
(let ((msg (my/-floating-tooltip-fill-string msg width prefix)))
|
||||||
(popup-tip msg)))
|
(if (display-graphic-p)
|
||||||
|
(my/posframe-tip name msg)
|
||||||
|
(popup-tip msg))))
|
||||||
|
|
||||||
;; flymake
|
;; flymake
|
||||||
(use-package flymake
|
(use-package flymake
|
||||||
@@ -1371,7 +1386,7 @@ If BUFFER is nil, the current buffer is used."
|
|||||||
out))
|
out))
|
||||||
|
|
||||||
(defun my/-add-list-dot-to-string (str)
|
(defun my/-add-list-dot-to-string (str)
|
||||||
"Add a dot (•) to the starrt of STR.
|
"Add a dot (•) to the start of STR.
|
||||||
If STR has multiple lines, add a space to the start of every other line."
|
If STR has multiple lines, add a space to the start of every other line."
|
||||||
(cl-labels ((rec (acc strs need-add)
|
(cl-labels ((rec (acc strs need-add)
|
||||||
(if strs
|
(if strs
|
||||||
@@ -1389,7 +1404,7 @@ If STR has multiple lines, add a space to the start of every other line."
|
|||||||
(let ((message))
|
(let ((message))
|
||||||
(when-let* (((bound-and-true-p flymake-mode))
|
(when-let* (((bound-and-true-p flymake-mode))
|
||||||
(diag (get-char-property (point) 'flymake-diagnostic)))
|
(diag (get-char-property (point) 'flymake-diagnostic)))
|
||||||
(cl-callf nconc message (string-split (flymake--diag-text diag) "\n" t)))
|
(cl-callf nconc message (list (flymake-diagnostic-text diag))))
|
||||||
(when (bound-and-true-p flycheck-mode)
|
(when (bound-and-true-p flycheck-mode)
|
||||||
(cl-callf nconc message
|
(cl-callf nconc message
|
||||||
(mapcar 'flycheck-error-message (flycheck-overlay-errors-at (point)))))
|
(mapcar 'flycheck-error-message (flycheck-overlay-errors-at (point)))))
|
||||||
@@ -1407,7 +1422,8 @@ If STR has multiple lines, add a space to the start of every other line."
|
|||||||
(when message
|
(when message
|
||||||
(my/floating-tooltip " *my-diagnostic-posframe*"
|
(my/floating-tooltip " *my-diagnostic-posframe*"
|
||||||
(mapconcat #'my/-add-list-dot-to-string
|
(mapconcat #'my/-add-list-dot-to-string
|
||||||
message "\n")))))
|
message "\n")
|
||||||
|
nil 4))))
|
||||||
|
|
||||||
(defconst my/consult-flymake-flycheck-narrow
|
(defconst my/consult-flymake-flycheck-narrow
|
||||||
'((?e . "Error")
|
'((?e . "Error")
|
||||||
|
|||||||
Reference in New Issue
Block a user