1 ;;; eldoc-overlay-mode.el --- Display eldoc with contextual documentation overlay.
3 ;; Author: stardiviner <numbchild@gmail.com>
4 ;; Keywords: eldoc overlay
5 ;; URL: https://github.com/stardiviner/eldoc-overlay-mode
6 ;; Created: 14th Jan 2017
8 ;; Package-Requires: ((emacs "24.3") (inline-docs "1.0.1") (quick-peek "1.0"))
15 ;;; ----------------------------------------------------------------------------
17 (defvar eldoc-overlay-mode-map
18 (let ((map (make-sparse-keymap)))
21 (defcustom eldoc-overlay-library
#'quick-peek
22 "Specify the library for displaying eldoc.
23 Two libraries currently supported: `inline-docs', and `quick-peek'.")
25 (defvar eldoc-overlay-function
(pcase eldoc-overlay-library
26 (`inline-docs
'inline-docs
)
27 (`quick-peek
'eldoc-overlay-quick-peek
))
28 "Specify the function for displaying eldoc.
29 Two functions currently supported: `inline-docs', and `quick-peek'.")
31 (defun eldoc-overlay-disable-in-org-mode ()
32 (setq-local eldoc-message-function
#'eldoc-minibuffer-message
))
34 (defun eldoc-overlay-quick-peek (format-string &rest args
)
37 (apply 'format format-string args
)
42 (define-minor-mode eldoc-overlay-mode
43 "Minor mode for displaying eldoc with contextual documentation overlay."
45 :lighter
" ElDoc overlay"
46 :keymap eldoc-overlay-mode-map
48 (if eldoc-overlay-mode
50 (setq eldoc-message-function eldoc-overlay-function
)
51 (add-hook 'post-command-hook
'quick-peek-hide
)
52 (add-hook 'org-mode-hook
#'eldoc-overlay-disable-in-org-mode
))
53 (setq eldoc-message-function
#'eldoc-minibuffer-message
)
57 ;;; ----------------------------------------------------------------------------
59 (provide 'eldoc-overlay-mode
)
61 ;;; eldoc-overlay-mode.el ends here