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 (defun eldoc-overlay-disable ()
33 "Disable `eldoc-overlay-mode' in some modes."
34 (setq-local eldoc-message-function
#'eldoc-minibuffer-message
))
36 (defun eldoc-overlay-quick-peek (format-string &rest args
)
39 (apply 'format format-string args
)
44 (define-minor-mode eldoc-overlay-mode
45 "Minor mode for displaying eldoc with contextual documentation overlay."
47 :lighter
" ElDoc overlay"
48 :keymap eldoc-overlay-mode-map
50 :require
'eldoc-overlay-mode
51 (if eldoc-overlay-mode
53 (setq eldoc-message-function eldoc-overlay-function
)
54 (add-hook 'post-command-hook
'quick-peek-hide
)
55 (add-hook 'org-mode-hook
#'eldoc-overlay-disable
))
56 (setq eldoc-message-function
#'eldoc-minibuffer-message
)
60 ;;; ----------------------------------------------------------------------------
62 (provide 'eldoc-overlay-mode
)
64 ;;; eldoc-overlay-mode.el ends here