Move flycheck back into init.el and add tooltip function
This commit is contained in:
parent
e1b2b36922
commit
cfbc99e5d4
32
disabled.el
32
disabled.el
@ -47,38 +47,6 @@
|
|||||||
;; (fido-mode 1)
|
;; (fido-mode 1)
|
||||||
;; (fido-vertical-mode 1))
|
;; (fido-vertical-mode 1))
|
||||||
|
|
||||||
;; flycheck
|
|
||||||
;; (use-package flycheck
|
|
||||||
;; :hook (emacs-lisp-mode . flycheck-mode)
|
|
||||||
;; :bind (:map flycheck-mode-map
|
|
||||||
;; ("C-c e" . my/flycheck-show-diagnostic-at-point))
|
|
||||||
;; :init
|
|
||||||
;; (setq flycheck-display-errors-function nil)
|
|
||||||
;; (defun my/flycheck-show-diagnostic-at-point ()
|
|
||||||
;; (interactive)
|
|
||||||
;; (if-let ((flycheck-mode)
|
|
||||||
;; (errors (flycheck-overlay-errors-at (point)))
|
|
||||||
;; (message (apply 'concat
|
|
||||||
;; (mapcar
|
|
||||||
;; (lambda (error)
|
|
||||||
;; (concat "•" (flycheck-error-message error) "\n"))
|
|
||||||
;; errors))))
|
|
||||||
;; (if (display-graphic-p)
|
|
||||||
;; (progn
|
|
||||||
;; (posframe-show " *flycheck-error-posframe*"
|
|
||||||
;; :string message
|
|
||||||
;; :position (point)
|
|
||||||
;; :max-width 80
|
|
||||||
;; :border-width 2
|
|
||||||
;; :border-color "white")
|
|
||||||
;; (clear-this-command-keys)
|
|
||||||
;; (push (read-event) unread-command-events)
|
|
||||||
;; (posframe-hide " *flycheck-error-posframe*"))
|
|
||||||
;; (popup-tip message)))))
|
|
||||||
;; (use-package consult-flycheck
|
|
||||||
;; :bind (:map flycheck-mode-map
|
|
||||||
;; ("C-c C-e" . consult-flycheck)))
|
|
||||||
|
|
||||||
;; lsp-mode
|
;; lsp-mode
|
||||||
;; (use-package consult-lsp)
|
;; (use-package consult-lsp)
|
||||||
;; (use-package lsp-mode
|
;; (use-package lsp-mode
|
||||||
|
64
init.el
64
init.el
@ -414,14 +414,39 @@ visual states."
|
|||||||
(use-package popup)
|
(use-package popup)
|
||||||
|
|
||||||
;; posframe
|
;; posframe
|
||||||
(use-package posframe)
|
(use-package posframe
|
||||||
|
:init
|
||||||
|
(defun my/posframe-tip (name msg)
|
||||||
|
"Like `popup-tip', but with a posframe.
|
||||||
|
NAME should be the buffer name to pass to `posframe-show'. MSG is the message to
|
||||||
|
display."
|
||||||
|
(unwind-protect
|
||||||
|
(progn
|
||||||
|
(posframe-show name
|
||||||
|
:string msg
|
||||||
|
:position (point)
|
||||||
|
:max-width 80
|
||||||
|
:border-width 2
|
||||||
|
:border-color "white")
|
||||||
|
(clear-this-command-keys)
|
||||||
|
(push (read-event) unread-command-events)
|
||||||
|
(posframe-hide name))
|
||||||
|
(posframe-hide name))))
|
||||||
|
|
||||||
|
(defun my/floating-tooltip (name msg)
|
||||||
|
"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
|
||||||
|
to `posframe-show' if the display is graphical."
|
||||||
|
(if (display-graphic-p)
|
||||||
|
(my/posframe-tip name msg)
|
||||||
|
(popup-tip msg)))
|
||||||
|
|
||||||
;; flymake
|
;; flymake
|
||||||
(use-package flymake
|
(use-package flymake
|
||||||
:bind (:map flymake-mode-map
|
:bind (:map flymake-mode-map
|
||||||
("C-c e" . my/flymake-show-diagnostic-at-point)
|
("C-c e" . my/flymake-show-diagnostic-at-point)
|
||||||
("C-c C-e" . consult-flymake))
|
("C-c C-e" . consult-flymake))
|
||||||
:hook (emacs-lisp-mode . flymake-mode)
|
;; :hook (emacs-lisp-mode . flymake-mode)
|
||||||
:init
|
:init
|
||||||
(defun my/flymake-show-diagnostic-at-point ()
|
(defun my/flymake-show-diagnostic-at-point ()
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -429,18 +454,29 @@ visual states."
|
|||||||
(diag (and flymake-mode
|
(diag (and flymake-mode
|
||||||
(get-char-property pos 'flymake-diagnostic)))
|
(get-char-property pos 'flymake-diagnostic)))
|
||||||
(message (flymake--diag-text diag)))
|
(message (flymake--diag-text diag)))
|
||||||
(if (display-graphic-p)
|
(my/floating-tooltip " *flymake-error-posframe*" message))))
|
||||||
(progn
|
|
||||||
(posframe-show " *flymake-error-posframe*"
|
;; flycheck
|
||||||
:string message
|
(use-package flycheck
|
||||||
:position (point)
|
:hook (emacs-lisp-mode . flycheck-mode)
|
||||||
:max-width 80
|
:bind (:map flycheck-mode-map
|
||||||
:border-width 2
|
("C-c e" . my/flycheck-show-diagnostic-at-point))
|
||||||
:border-color "white")
|
:init
|
||||||
(clear-this-command-keys)
|
(setq flycheck-display-errors-function nil)
|
||||||
(push (read-event) unread-command-events)
|
(defun my/flycheck-show-diagnostic-at-point ()
|
||||||
(posframe-hide " *flymake-error-posframe*"))
|
(interactive)
|
||||||
(popup-tip message)))))
|
(if-let ((flycheck-mode)
|
||||||
|
(errors (flycheck-overlay-errors-at (point)))
|
||||||
|
(message (apply 'concat
|
||||||
|
(mapcar
|
||||||
|
(lambda (error)
|
||||||
|
(concat "•" (flycheck-error-message error) "\n"))
|
||||||
|
errors))))
|
||||||
|
(my/floating-tooltip " *flycheck-error-posframe*"
|
||||||
|
(substring message 0 (1- (length message)))))))
|
||||||
|
(use-package consult-flycheck
|
||||||
|
:bind (:map flycheck-mode-map
|
||||||
|
("C-c C-e" . consult-flycheck)))
|
||||||
|
|
||||||
;; eldoc
|
;; eldoc
|
||||||
(use-package eldoc
|
(use-package eldoc
|
||||||
|
Loading…
Reference in New Issue
Block a user