[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 82f8ae9c9e 4/7: Add corfu-infoframe-map
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 82f8ae9c9e 4/7: Add corfu-infoframe-map |
Date: |
Fri, 18 Nov 2022 05:57:33 -0500 (EST) |
branch: externals/corfu
commit 82f8ae9c9e3a8e35add9b7e772d712b32b2f115e
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add corfu-infoframe-map
---
extensions/corfu-infoframe.el | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/extensions/corfu-infoframe.el b/extensions/corfu-infoframe.el
index f6cc215e95..270e435401 100644
--- a/extensions/corfu-infoframe.el
+++ b/extensions/corfu-infoframe.el
@@ -32,12 +32,11 @@
;; Display a documentation popup for completion candidate when using
;; Corfu. The `corfu-infoframe-mode' must be enabled globally. Set
;; `corfu-infoframe-auto' if you want the documentation popup frame to
-;; be displayed automatically. If you prefer manual toggling bind
-;; `corfu-infoframe-toggle' to a key in `corfu-map':
-;;
-;; (define-key corfu-map "\M-d" #'corfu-infoframe-toggle)
-;; (define-key corfu-map "\M-g" #'corfu-infoframe-location)
-;; (define-key corfu-map "\M-h" #'corfu-infoframe-documentation)
+;; be displayed automatically. For manual toggling the commands
+;; `corfu-infoframe-toggle', `corfu-infoframe-location' and
+;; `corfu-infoframe-documentation' are bound in the
+;; `corfu-infoframe-map'. `corfu-infoframe-toggle' to a key in
+;; `corfu-map'.
;;; Code:
@@ -81,6 +80,14 @@
:group 'corfu
:type 'boolean)
+(defvar corfu-infoframe-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\M-d" #'corfu-infoframe-documentation)
+ (define-key map "\M-l" #'corfu-infoframe-location)
+ (define-key map "\M-t" #'corfu-infoframe-toggle)
+ map)
+ "Additional keymap activated in infoframe mode.")
+
(defvar-local corfu-infoframe--toggle t
"Local infoframe toggle state.")
@@ -386,6 +393,8 @@ not be displayed until this command is called again, even if
(defun corfu-infoframe--exhibit (&rest _)
"Update the info frame automatically."
+ (add-to-list 'minor-mode-overriding-map-alist
+ `(,#'corfu-infoframe-mode . ,corfu-infoframe-map))
(if (and (frame-live-p corfu--frame)
(frame-visible-p corfu--frame)
(>= corfu--index 0))
@@ -405,22 +414,25 @@ not be displayed until this command is called again, even
if
#'corfu-infoframe--show candidate)))))
(corfu-infoframe--hide)))
+(defun corfu-infoframe--teardown ()
+ "Teardown the info frame state."
+ (corfu-infoframe--hide)
+ (mapc #'kill-local-variable corfu-infoframe--state-vars)
+ (setq minor-mode-overriding-map-alist
+ (assq-delete-all #'corfu-infoframe-mode
+ minor-mode-overriding-map-alist)))
+
;;;###autoload
(define-minor-mode corfu-infoframe-mode
"Corfu info frame minor mode."
:global t :group 'corfu
(cond
(corfu-infoframe-mode
- ;; TODO seq-union (Emacs 28, seq compatibility package?)
- (setq corfu--state-vars (seq-uniq (append corfu--state-vars
- corfu-infoframe--state-vars)))
(advice-add #'corfu--exhibit :after #'corfu-infoframe--exhibit)
- (advice-add #'corfu--teardown :before #'corfu-infoframe--hide))
+ (advice-add #'corfu--teardown :before #'corfu-infoframe--teardown))
(t
- (setq corfu--state-vars (seq-difference corfu--state-vars
- corfu-infoframe--state-vars))
(advice-remove #'corfu--exhibit #'corfu-infoframe--exhibit)
- (advice-remove #'corfu--teardown #'corfu-infoframe--hide))))
+ (advice-remove #'corfu--teardown #'corfu-infoframe--teardown))))
(provide 'corfu-infoframe)
;;; corfu-infoframe.el ends here
- [elpa] externals/corfu updated (9f735cf4e6 -> cfc97d4885), ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 4e0ee2f98e 5/7: corfu-infoframe: Update commentary, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 7aa006e000 6/7: corfu-infoframe: Remap scroll commands, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu cfc97d4885 7/7: corfu-infoframe: Reduce print length (Fix #249), ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 52f6701197 1/7: Try to implement location support for docframe, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 4e5a41b8fd 2/7: Add corfu-docframe-location and corfu-docframe-documentation, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu de6c1dd044 3/7: Rename to corfu-infoframe, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 82f8ae9c9e 4/7: Add corfu-infoframe-map,
ELPA Syncer <=