summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Nguyen <james@jojojames.com>2022-04-13 11:27:03 -0400
committerJames Nguyen <james@jojojames.com>2022-04-13 11:28:07 -0400
commitd9b9381eb3edaf7deb0992fa124d5f08b5374003 (patch)
tree546fc2a0d06fac9dc33d6008b4bc6f371f22557f
parent86abadd96cf611989af2d07efbf60766d06a5c74 (diff)
Add eldoc (#551)
-rw-r--r--evil-collection.el1
-rw-r--r--modes/eldoc/evil-collection-eldoc.el62
-rw-r--r--modes/restclient/evil-collection-restclient.el2
3 files changed, 64 insertions, 1 deletions
diff --git a/evil-collection.el b/evil-collection.el
index 61c218a..555814e 100644
--- a/evil-collection.el
+++ b/evil-collection.el
@@ -150,6 +150,7 @@ This will bind additional find-* type commands, e.g. usages, assignments, etc.."
ediff
eglot
explain-pause-mode
+ eldoc
elfeed
elisp-mode
elisp-refs
diff --git a/modes/eldoc/evil-collection-eldoc.el b/modes/eldoc/evil-collection-eldoc.el
new file mode 100644
index 0000000..0a1cb74
--- /dev/null
+++ b/modes/eldoc/evil-collection-eldoc.el
@@ -0,0 +1,62 @@
+;;; evil-collection-eldoc.el --- Bindings for `eldoc' -*- lexical-binding: t -*-
+
+;; Copyright (C) 2022 James Nguyen
+
+;; Author: James Nguyen <james@jojojames.com>
+;; Maintainer: James Nguyen <james@jojojames.com>
+;; URL: https://github.com/emacs-evil/evil-collection
+;; Version: 0.0.2
+;; Package-Requires: ((emacs "27.1"))
+;; Keywords: evil, emacs, tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;; Bindings for `eldoc'.
+
+;;; Code:
+(require 'evil-collection)
+(require 'eldoc nil t)
+
+(defconst evil-collection-eldoc-maps
+ '(evil-collection-eldoc-doc-buffer-mode-map))
+
+(defvar eldoc--doc-buffer) ;; Internal to `eldoc'.
+
+(defvar evil-collection-eldoc-doc-buffer-mode-map (make-sparse-keymap))
+
+(define-minor-mode evil-collection-eldoc-doc-buffer-mode
+ "A minor mode to attach to `eldoc-doc-buffer' buffers."
+ :group 'evil-collection-eldoc-mode
+ :keymap evil-collection-eldoc-doc-buffer-mode-map
+ :lighter nil)
+
+(defun evil-collection-eldoc-setup-doc-buffer-mode (&rest _)
+ "Set up `evil-collection-eldoc-doc-buffer-mode'."
+ (with-current-buffer eldoc--doc-buffer
+ (evil-collection-eldoc-doc-buffer-mode +1)
+ (evil-normalize-keymaps)))
+
+;;;###autoload
+(defun evil-collection-eldoc-setup ()
+ "Set up `evil' bindings for `eldoc'."
+ (evil-collection-define-key 'normal 'evil-collection-eldoc-doc-buffer-mode-map
+ "q" 'quit-window)
+
+ ;; Enable a separate minor mode so that we can bind keys to it.
+ (advice-add 'eldoc-doc-buffer
+ :after 'evil-collection-eldoc-setup-doc-buffer-mode))
+
+(provide 'evil-collection-eldoc)
+;;; evil-collection-eldoc.el ends here
diff --git a/modes/restclient/evil-collection-restclient.el b/modes/restclient/evil-collection-restclient.el
index fb9e25f..6921a88 100644
--- a/modes/restclient/evil-collection-restclient.el
+++ b/modes/restclient/evil-collection-restclient.el
@@ -53,10 +53,10 @@
(evil-collection-define-key 'normal 'restclient-mode-map
"[[" 'restclient-jump-prev
"]]" 'restclient-jump-next)
- ;; Enable a separate minor mode so that we can bind keys to it.
(evil-collection-define-key 'normal 'evil-collection-restclient-mode-map
"q" 'quit-window)
+ ;; Enable a separate minor mode so that we can bind keys to it.
(add-hook 'restclient-response-loaded-hook
#'evil-collection-restclient-setup-result-mode))