1

Replace eldoc-box with eldoc-frame

This commit is contained in:
Jessie Hildebrandt 2023-12-08 08:06:23 -05:00
parent e760eac4df
commit 0872c1aaec

37
init.el
View File

@ -1200,42 +1200,19 @@ DOCSTRING is an optional form that is discarded upon expansion."
(diff-hl-flydiff-mode)) (diff-hl-flydiff-mode))
;; ---------------------------------- ;; ;; ---------------------------------- ;;
;; eldoc-box ;; eldoc-frame
;; ---------------------------------- ;; ;; ---------------------------------- ;;
(external-package eldoc-box (editor-feature eldoc-frame
"Displays documentation from Eldoc in a floating popup." "Displays ElDoc documentation in floating child frames."
:preface
(defun user/scroll-eldoc-box (count)
"Scrolls the `eldoc-box' window by COUNT lines if it visible."
(when (and (boundp 'eldoc-box--frame)
eldoc-box--frame
(frame-visible-p eldoc-box--frame))
(with-selected-frame eldoc-box--frame
(scroll-up count))))
:config
(dolist (parameter '((left-fringe . 12) (right-fringe . 12) (alpha-background . 90)))
(add-to-list 'eldoc-box-frame-parameters parameter))
(add-hook 'eldoc-box-buffer-hook (lambda (&rest _args)
(goto-char (point-min))
(insert (propertize "\n\s" 'face '(:height 0.2)))
(goto-char (point-max))
(insert (propertize "\n\s" 'face '(:height 0.2)))))
(add-hook 'eldoc-box-frame-hook (lambda (&rest _args)
(setq-local line-spacing 0.25
pixel-scroll-precision-mode nil
global-hl-line-mode nil)))
:custom :custom
(eldoc-box-offset '(16 42 16) "Set a higher right offset for the popups to accomodate for the fringes")
(eldoc-documentation-strategy 'eldoc-documentation-compose "Combine results from all documentation sources") (eldoc-documentation-strategy 'eldoc-documentation-compose "Combine results from all documentation sources")
(eldoc-box-max-pixel-width (lambda () (min 500 (/ (frame-outer-width) 4))) "Limit doc popup to 500 pixels wide")
(eldoc-box-max-pixel-height (lambda () (min 300 (/ (frame-outer-height) 4))) "Limit doc popup to 300 pixels tall")
(eldoc-box-doc-separator (propertize "\n\s\n" 'display '(space :width text) 'face '(:strike-through t)))
:hook :hook
(eldoc-mode-hook . eldoc-box-hover-mode) (eldoc-mode-hook . eldoc-frame-mode)
:bind :bind
("M-<up>" . (lambda () (interactive) (user/scroll-eldoc-box -1))) (:map eldoc-frame-mode-map
("M-<down>" . (lambda () (interactive) (user/scroll-eldoc-box 1)))) ("M-<up>" . eldoc-frame-scroll-down-line)
("M-<down>" . eldoc-frame-scroll-up-line)))
;; ---------------------------------- ;; ;; ---------------------------------- ;;
;; eshell-up ;; eshell-up