Fix byte compiler warnings

* eldoc-box.el (require): New require form.
(eldoc-box-hover-at-point-mode, eldoc-box-hover-at-point-mode,
eldoc-box-hover-mode, eldoc-box-hover-at-point-mode): Move below.
(eglot--hover-info, eglot--current-server-or-lose,
eglot--TextDocumentPositionParams, eglot--error, jsonrpc-request): New
declare forms.
This commit is contained in:
Jimmy Yuen Ho Wong 2021-03-25 15:24:50 +00:00 committed by Yuan Fu
parent d4574ee392
commit 10c792cc40
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -38,6 +38,7 @@
;;
(require 'cl-lib)
(require 'seq)
;;;; Userland
;;;;; Variable
@ -161,41 +162,6 @@ Intended for internal use."
(delete-frame eldoc-box--frame)
(setq eldoc-box--frame nil)))
;; please compiler
(defvar eldoc-box-hover-at-point-mode)
(declare-function eldoc-box-hover-at-point-mode "eldoc-box.el")
;;;###autoload
(define-minor-mode eldoc-box-hover-mode
"Displays hover documentations in a childframe.
The default position of childframe is upper corner."
:lighter " ELDOC-BOX"
(if eldoc-box-hover-mode
(progn (when eldoc-box-hover-at-point-mode
(eldoc-box-hover-at-point-mode -1))
(eldoc-box--enable))
(eldoc-box--disable)))
;;;###autoload
(define-minor-mode eldoc-box-hover-at-point-mode
"A convenient minor mode to display doc at point.
You can use C-g to hide the doc."
:lighter " ELDOC-BOX"
(if eldoc-box-hover-at-point-mode
(progn (when eldoc-box-hover-mode
(eldoc-box-hover-mode -1))
(setq-local eldoc-box-position-function
#'eldoc-box--default-at-point-position-function)
(setq-local eldoc-box-clear-with-C-g t)
(remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t)
(add-hook 'post-command-hook #'eldoc-box--follow-cursor t t)
(eldoc-box--enable))
(eldoc-box--disable)
(add-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t)
(remove-hook 'post-command-hook #'eldoc-box--follow-cursor t)
(kill-local-variable 'eldoc-box-position-function)
(kill-local-variable 'eldoc-box-clear-with-C-g)))
;;;; Backstage
;;;;; Variable
(defvar eldoc-box--buffer " *eldoc-box*"
@ -422,6 +388,37 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
(run-with-timer eldoc-box-cleanup-interval nil #'eldoc-box--maybe-cleanup)))
multi-line-p)))
;;;###autoload
(define-minor-mode eldoc-box-hover-mode
"Displays hover documentations in a childframe.
The default position of childframe is upper corner."
:lighter " ELDOC-BOX"
(if eldoc-box-hover-mode
(progn (when eldoc-box-hover-at-point-mode
(eldoc-box-hover-at-point-mode -1))
(eldoc-box--enable))
(eldoc-box--disable)))
;;;###autoload
(define-minor-mode eldoc-box-hover-at-point-mode
"A convenient minor mode to display doc at point.
You can use C-g to hide the doc."
:lighter " ELDOC-BOX"
(if eldoc-box-hover-at-point-mode
(progn (when eldoc-box-hover-mode
(eldoc-box-hover-mode -1))
(setq-local eldoc-box-position-function
#'eldoc-box--default-at-point-position-function)
(setq-local eldoc-box-clear-with-C-g t)
(remove-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t)
(add-hook 'post-command-hook #'eldoc-box--follow-cursor t t)
(eldoc-box--enable))
(eldoc-box--disable)
(add-hook 'pre-command-hook #'eldoc-pre-command-refresh-echo-area t)
(remove-hook 'post-command-hook #'eldoc-box--follow-cursor t)
(kill-local-variable 'eldoc-box-position-function)
(kill-local-variable 'eldoc-box-clear-with-C-g)))
;;;; Eglot helper
(defvar eldoc-box-eglot-help-at-point-last-point 0
@ -438,6 +435,11 @@ If (point) != last point, cleanup frame.")
(defvar eglot--managed-mode)
(declare-function eglot--dbind "eglot.el")
(declare-function eglot--hover-info "eglot.el")
(declare-function eglot--current-server-or-lose "eglot.el")
(declare-function eglot--TextDocumentPositionParams "eglot.el")
(declare-function eglot--error "eglot.el")
(declare-function jsonrpc-request "jsonrpc")
(defun eldoc-box-eglot-help-at-point ()