diff options
| -rw-r--r-- | README.org | 4 | ||||
| -rw-r--r-- | extensions/corfu-popupinfo.el (renamed from extensions/corfu-infoframe.el) | 349 |
2 files changed, 176 insertions, 177 deletions
@@ -453,8 +453,8 @@ following extensions come with the Corfu ELPA package: - [[https://github.com/minad/corfu/blob/main/extensions/corfu-indexed.el][corfu-indexed]]: =corfu-indexed-mode= allows you to select indexed candidates with prefix arguments. - [[https://github.com/minad/corfu/blob/main/extensions/corfu-info.el][corfu-info]]: Actions to access the candidate location and documentation. -- [[https://github.com/minad/corfu/blob/main/extensions/corfu-infoframe.el][corfu-infoframe]]: Display candidate documentation or source in a popup frame - next to the candidate menu. +- [[https://github.com/minad/corfu/blob/main/extensions/corfu-popupinfo.el][corfu-popupinfo]]: Display candidate documentation or source in a popup next to + the candidate menu. - [[https://github.com/minad/corfu/blob/main/extensions/corfu-quick.el][corfu-quick]]: Commands to select using Avy-style quick keys. See the Commentary of those files for configuration details. diff --git a/extensions/corfu-infoframe.el b/extensions/corfu-popupinfo.el index 5211015..c5d3e5c 100644 --- a/extensions/corfu-infoframe.el +++ b/extensions/corfu-popupinfo.el @@ -1,4 +1,4 @@ -;;; corfu-infoframe.el --- Candidate information popup frame for Corfu -*- lexical-binding: t -*- +;;; corfu-popupinfo.el --- Candidate information popup for Corfu -*- lexical-binding: t -*- ;; Copyright (C) 2021-2022 Free Software Foundation, Inc. @@ -30,13 +30,13 @@ ;; experimental. The public interface may change any time. ;; ;; 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. +;; Corfu. The `corfu-popupinfo-mode' must be enabled globally. Set +;; `corfu-popupinfo-auto' if you want the documentation popup to 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'. +;; For manual toggling the commands `corfu-popupinfo-toggle', +;; `corfu-popupinfo-location' and `corfu-popupinfo-documentation' are +;; bound in the `corfu-popupinfo-map'. ;;; Code: @@ -44,70 +44,70 @@ (eval-when-compile (require 'subr-x)) -(defface corfu-infoframe +(defface corfu-popupinfo '((t :inherit corfu-default :height 0.8)) - "Face used for the info frame." + "Face used for the info popup." :group 'corfu-faces) -(defcustom corfu-infoframe-auto t - "Display documentation popup automatically." +(defcustom corfu-popupinfo-auto t + "Display info popup automatically." :group 'corfu :type 'boolean) -(defcustom corfu-infoframe-delay 1.0 +(defcustom corfu-popupinfo-delay 1.0 "The number of seconds to wait before displaying the documentation popup." :group 'corfu :type '(choice (const :tag "immediate" 0) (number :tag "seconds"))) -(defcustom corfu-infoframe-hide t +(defcustom corfu-popupinfo-hide t "Hide the popup during the transition between candidates." :group 'corfu :type 'boolean) -(defcustom corfu-infoframe-max-width 50 - "The max width of the info frame in characters." +(defcustom corfu-popupinfo-max-width 50 + "The max width of the info popup in characters." :group 'corfu :type 'integer) -(defcustom corfu-infoframe-max-height 10 - "The max height of the info frame in characters." +(defcustom corfu-popupinfo-max-height 10 + "The max height of the info popup in characters." :group 'corfu :type 'integer) -(defcustom corfu-infoframe-resize t - "Resize the info frame automatically if non-nil." +(defcustom corfu-popupinfo-resize t + "Resize the info popup automatically if non-nil." :group 'corfu :type 'boolean) -(defvar corfu-infoframe-map +(defvar corfu-popupinfo-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) - (define-key map [remap scroll-other-window] #'corfu-infoframe-scroll-up) - (define-key map [remap scroll-other-window-down] #'corfu-infoframe-scroll-down) + (define-key map "\M-d" #'corfu-popupinfo-documentation) + (define-key map "\M-l" #'corfu-popupinfo-location) + (define-key map "\M-t" #'corfu-popupinfo-toggle) + (define-key map [remap scroll-other-window] #'corfu-popupinfo-scroll-up) + (define-key map [remap scroll-other-window-down] #'corfu-popupinfo-scroll-down) map) - "Additional keymap activated in infoframe mode.") + "Additional keymap activated in popupinfo mode.") -(defvar-local corfu-infoframe--toggle t - "Local infoframe toggle state.") +(defvar-local corfu-popupinfo--toggle t + "Local popupinfo toggle state.") -(defvar-local corfu-infoframe--function - #'corfu-infoframe--get-documentation - "Documentation function.") +(defvar-local corfu-popupinfo--function + #'corfu-popupinfo--get-documentation + "Function called to obtain documentation string.") -(defvar corfu-infoframe--frame nil - "Info frame.") +(defvar corfu-popupinfo--frame nil + "Info popup child frame.") -(defvar corfu-infoframe--auto-timer nil - "Corfu info frame auto display timer.") +(defvar corfu-popupinfo--auto-timer nil + "Corfu info popup auto display timer.") -(defvar-local corfu-infoframe--candidate nil - "Completion candidate for the info frame.") +(defvar-local corfu-popupinfo--candidate nil + "Completion candidate for the info popup.") -(defvar-local corfu-infoframe--edges nil - "Coordinates of the corfu popup's edges. +(defvar-local corfu-popupinfo--edges nil + "Coordinates of the candidate popup edges. The coordinates list has the form (LEFT TOP RIGHT BOTTOM) where all values are in pixels relative to the origin - the position (0, 0) @@ -115,23 +115,23 @@ values are in pixels relative to the origin - the position (0, 0) relative to LEFT and TOP which are both zero. See `frame-edges' for details.") -(defvar-local corfu-infoframe--direction nil - "Position direction of the info frame relative to the corfu popup.") +(defvar-local corfu-popupinfo--direction nil + "Position direction of the info popup relative to the candidate popup.") -(defconst corfu-infoframe--state-vars - '(corfu-infoframe--candidate - corfu-infoframe--edges - corfu-infoframe--direction - corfu-infoframe--toggle - corfu-infoframe--function) - "Buffer-local state variables used by corfu-infoframe.") +(defconst corfu-popupinfo--state-vars + '(corfu-popupinfo--candidate + corfu-popupinfo--edges + corfu-popupinfo--direction + corfu-popupinfo--toggle + corfu-popupinfo--function) + "Buffer-local state variables used by corfu-popupinfo.") -(defun corfu-infoframe--visible-p () - "Determine whether the info frame is visible." - (and (frame-live-p corfu-infoframe--frame) - (frame-visible-p corfu-infoframe--frame))) +(defun corfu-popupinfo--visible-p () + "Determine whether the info popup is visible." + (and (frame-live-p corfu-popupinfo--frame) + (frame-visible-p corfu-popupinfo--frame))) -(defun corfu-infoframe--get-location (candidate) +(defun corfu-popupinfo--get-location (candidate) "Get source at location of CANDIDATE." (save-excursion (when-let* ((fun (plist-get corfu--extra :company-location)) @@ -146,13 +146,13 @@ See `frame-edges' for details.") (goto-char (point-min)) (forward-line (1- (cdr loc)))) (let ((beg (point))) - (forward-line (* 2 corfu-infoframe-max-height)) + (forward-line (* 2 corfu-popupinfo-max-height)) (when jit-lock-mode (jit-lock-fontify-now beg (point))) (setq res (buffer-substring beg (point))) (and (not (string-blank-p res)) res)))))))) -(defun corfu-infoframe--get-documentation (candidate) +(defun corfu-popupinfo--get-documentation (candidate) "Get the documentation for CANDIDATE." (when-let* ((fun (plist-get corfu--extra :company-doc-buffer)) (res (save-excursion @@ -160,8 +160,8 @@ See `frame-edges' for details.") (message-log-max nil) ;; Reduce print length for elisp backend (#249) (print-level 3) - (print-length (* corfu-infoframe-max-width - corfu-infoframe-max-height))) + (print-length (* corfu-popupinfo-max-width + corfu-popupinfo-max-height))) (funcall fun candidate))))) (with-current-buffer (or (car-safe res) res) (setq res (replace-regexp-in-string @@ -170,20 +170,20 @@ See `frame-edges' for details.") (and (not (string-blank-p res)) res)))) ;; TODO get rid of optional arguments? -(defun corfu-infoframe--size (&optional width height) +(defun corfu-popupinfo--size (&optional width height) "Calculate popup size in the form of (width height). If WIDTH and HEIGHT is speicified, just return (WIDTH HEIGHT)." - (let ((max-width (* (frame-char-width) corfu-infoframe-max-width)) - (max-height (* (default-line-height) corfu-infoframe-max-height))) + (let ((max-width (* (frame-char-width) corfu-popupinfo-max-width)) + (max-height (* (default-line-height) corfu-popupinfo-max-height))) (if (and width height) (list (min width max-width) (min height max-height)) (pcase-let* ((`(,popup-width ,popup-height) - (if (not corfu-infoframe-resize) + (if (not corfu-popupinfo-resize) (list (or width max-width) (or height max-height)) (pcase-let ((`(,win-width . ,win-height) (save-window-excursion - (with-current-buffer " *corfu-infoframe*" + (with-current-buffer " *corfu-popupinfo*" (set-window-dedicated-p nil nil) (set-window-buffer nil (current-buffer)) (window-text-pixel-size nil (point-min) (point-max) @@ -191,7 +191,7 @@ If WIDTH and HEIGHT is speicified, just return (WIDTH HEIGHT)." (list (or width win-width) (or height win-height)))))) (list (min popup-width max-width) (min popup-height max-height)))))) -(defun corfu-infoframe--frame-geometry (frame) +(defun corfu-popupinfo--frame-geometry (frame) "Return position and size geometric attributes of FRAME. The geometry represents the position and size in pixels @@ -199,20 +199,19 @@ in the form of (X Y WIDTH HEIGHT)." (pcase-let ((`(,x . ,y) (frame-position frame))) (list x y (frame-pixel-width frame) (frame-pixel-height frame)))) -(defun corfu-infoframe--display-area-horizontal (width height) - "Calculate the horizontal display area for the info frame. - -The WIDTH and HEIGHT of the info frame are in pixels. +(defun corfu-popupinfo--display-area-horizontal (width height) + "Calculate the horizontal display area for the info popup. +The WIDTH and HEIGHT of the info popup are in pixels. The calculated area is in the form (X Y WIDTH HEIGHT DIRECTION). -DIRECTION indicates the horizontal position direction of the info frame -relative to the corfu popup, its value can be 'right or 'left." +DIRECTION indicates the horizontal position direction of the info popup +relative to the candidate popup, its value can be 'right or 'left." (pcase-let* ((border (alist-get 'child-frame-border-width corfu--frame-parameters)) - ;; space between candidates popup and info frame + ;; space between candidates popup and info popup (space (- border)) ;; share the border (`(,_pfx ,_pfy ,pfw ,_pfh) - (corfu-infoframe--frame-geometry (frame-parent corfu--frame))) - (`(,cfx ,cfy ,cfw ,_cfh) (corfu-infoframe--frame-geometry corfu--frame)) + (corfu-popupinfo--frame-geometry (frame-parent corfu--frame))) + (`(,cfx ,cfy ,cfw ,_cfh) (corfu-popupinfo--frame-geometry corfu--frame)) (x-on-right (+ cfx cfw space)) (w-remaining-right (- pfw 1 x-on-right border border)) (x-on-left (- cfx space border width border)) @@ -228,21 +227,21 @@ relative to the corfu popup, its value can be 'right or 'left." (t (list x-on-left cfy w-remaining-left height 'left))))) -(defun corfu-infoframe--display-area-vertical (width height) - "Calculate the vertical display area for the info frame. +(defun corfu-popupinfo--display-area-vertical (width height) + "Calculate the vertical display area for the info popup. -The WIDTH and HEIGHT of the info frame are in pixels. +The WIDTH and HEIGHT of the info popup are in pixels. The calculated area is in the form (X Y WIDTH HEIGHT DIRECTION). -DIRECTION indicates the vertical position direction of the info frame -relative to the corfu popup, its value can be 'bottom or 'top." +DIRECTION indicates the vertical position direction of the info popup +relative to the candidate popup, its value can be 'bottom or 'top." (pcase-let* ((a-y 0) (a-height height) (a-direction 'bottom) (border (alist-get 'child-frame-border-width corfu--frame-parameters)) (space (- border)) (lh (default-line-height)) (`(,_pfx ,_pfy ,pfw ,pfh) - (corfu-infoframe--frame-geometry (frame-parent corfu--frame))) - (`(,cfx ,cfy ,_cfw ,cfh) (corfu-infoframe--frame-geometry corfu--frame)) + (corfu-popupinfo--frame-geometry (frame-parent corfu--frame))) + (`(,cfx ,cfy ,_cfw ,cfh) (corfu-popupinfo--frame-geometry corfu--frame)) (cf-on-cursor-bottom-p (>= cfy (+ (cadr (window-inside-pixel-edges)) @@ -266,54 +265,54 @@ relative to the corfu popup, its value can be 'bottom or 'top." (setq a-y (max 0 (- cfy space border height border)))) (list cfx a-y a-width a-height a-direction))) -(defun corfu-infoframe--display-area (direction width height) - "Calculate the display area for the info frame. +(defun corfu-popupinfo--display-area (direction width height) + "Calculate the display area for the info popup. If DIRECTION is non-nil, the display area in the corresponding direction is calculated first, its value can be 'bottom, 'top,'right or 'left. -The pixel size of the info frame can be specified by WIDTH and HEIGHT. +The pixel size of the info popup can be specified by WIDTH and HEIGHT. The calculated area is in the form (X Y WIDTH HEIGHT DIRECTION). -DIRECTION indicates the position direction of the info frame relative to -the corfu popup, its value is 'bottom, 'top, 'right or 'left." +DIRECTION indicates the position direction of the info popup relative to +the candidate popup, its value is 'bottom, 'top, 'right or 'left." ;; TODO wrong (cond ((member direction '(right left)) - (apply #'corfu-infoframe--display-area-horizontal - (corfu-infoframe--size))) + (apply #'corfu-popupinfo--display-area-horizontal + (corfu-popupinfo--size))) ((member direction '(bottom top)) - (apply #'corfu-infoframe--display-area-vertical - (corfu-infoframe--size))) + (apply #'corfu-popupinfo--display-area-vertical + (corfu-popupinfo--size))) (t (pcase-let* ((`(,width ,height) ;; popup inner width and height - (corfu-infoframe--size width height)) + (corfu-popupinfo--size width height)) ((and h-a `(,_h-x ,_h-y ,h-w ,h-h ,_h-d)) - (corfu-infoframe--display-area-horizontal width height)) + (corfu-popupinfo--display-area-horizontal width height)) ((and v-a `(,_v-x ,_v-y ,v-w ,v-h ,_v-d)) - (corfu-infoframe--display-area-vertical width height))) + (corfu-popupinfo--display-area-vertical width height))) (if (and (or (< h-h height) (< h-w width)) (or (>= (* v-w v-h) (* h-w h-h)) (and (>= v-h height) (>= v-w width)))) v-a h-a))))) -(defun corfu-infoframe--show (candidate) - "Show the info frame for CANDIDATE." - (when corfu-infoframe--auto-timer - (cancel-timer corfu-infoframe--auto-timer) - (setq corfu-infoframe--auto-timer nil)) +(defun corfu-popupinfo--show (candidate) + "Show the info popup for CANDIDATE." + (when corfu-popupinfo--auto-timer + (cancel-timer corfu-popupinfo--auto-timer) + (setq corfu-popupinfo--auto-timer nil)) (when (and (corfu--popup-support-p) (frame-live-p corfu--frame) (frame-visible-p corfu--frame)) (let* ((doc-changed - (not (and (corfu-infoframe--visible-p) - (equal candidate corfu-infoframe--candidate)))) + (not (and (corfu-popupinfo--visible-p) + (equal candidate corfu-popupinfo--candidate)))) (new-edges (frame-edges corfu--frame 'inner-edges)) - (edges-changed (not (equal new-edges corfu-infoframe--edges)))) + (edges-changed (not (equal new-edges corfu-popupinfo--edges)))) (when doc-changed - (if-let (doc (funcall corfu-infoframe--function candidate)) - (with-current-buffer (corfu--make-buffer " *corfu-infoframe*" doc) + (if-let (doc (funcall corfu-popupinfo--function candidate)) + (with-current-buffer (corfu--make-buffer " *corfu-popupinfo*" doc) ;; TODO extract settings (setq-local line-move-visual t truncate-partial-width-windows nil @@ -323,128 +322,128 @@ the corfu popup, its value is 'bottom, 'top, 'right or 'left." word-wrap t fringe-indicator-alist '((continuation)) face-remapping-alist (copy-tree face-remapping-alist)) - (setf (alist-get 'default face-remapping-alist) 'corfu-infoframe)) - (corfu-infoframe--hide) + (setf (alist-get 'default face-remapping-alist) 'corfu-popupinfo)) + (corfu-popupinfo--hide) (setq doc-changed nil edges-changed nil))) (when (or doc-changed edges-changed) (pcase-let* ((border (alist-get 'child-frame-border-width corfu--frame-parameters)) (`(,area-x ,area-y ,area-w ,area-h ,area-d) - (corfu-infoframe--display-area - corfu-infoframe--direction + (corfu-popupinfo--display-area + corfu-popupinfo--direction (and (not doc-changed) - (- (frame-pixel-width corfu-infoframe--frame) border border)) + (- (frame-pixel-width corfu-popupinfo--frame) border border)) (and (not doc-changed) - (- (frame-pixel-height corfu-infoframe--frame) border border))))) - (setq corfu-infoframe--frame - (corfu--make-frame corfu-infoframe--frame + (- (frame-pixel-height corfu-popupinfo--frame) border border))))) + (setq corfu-popupinfo--frame + (corfu--make-frame corfu-popupinfo--frame area-x area-y area-w area-h - (get-buffer " *corfu-infoframe*")) - corfu-infoframe--direction area-d))) - (setq corfu-infoframe--candidate candidate - corfu-infoframe--edges new-edges)))) + (get-buffer " *corfu-popupinfo*")) + corfu-popupinfo--direction area-d))) + (setq corfu-popupinfo--candidate candidate + corfu-popupinfo--edges new-edges)))) -(defun corfu-infoframe--hide () - "Clear the info frame buffer content and hide it." - (corfu--hide-frame corfu-infoframe--frame)) +(defun corfu-popupinfo--hide () + "Clear the info popup buffer content and hide it." + (corfu--hide-frame corfu-popupinfo--frame)) -(defun corfu-infoframe-scroll-up (&optional n) - "Scroll text of info frame window upward N lines. +(defun corfu-popupinfo-scroll-up (&optional n) + "Scroll text of info popup window upward N lines. If ARG is omitted or nil, scroll upward by a near full screen. See `scroll-up' for details." (interactive "p") - (when (corfu-infoframe--visible-p) - (with-selected-frame corfu-infoframe--frame - (with-current-buffer (get-buffer " *corfu-infoframe*") + (when (corfu-popupinfo--visible-p) + (with-selected-frame corfu-popupinfo--frame + (with-current-buffer (get-buffer " *corfu-popupinfo*") (scroll-up n))))) -(defun corfu-infoframe-scroll-down (&optional n) - "Scroll text of info frame window down N lines. +(defun corfu-popupinfo-scroll-down (&optional n) + "Scroll text of info popup window down N lines. If ARG is omitted or nil, scroll down by a near full screen." (interactive "p") - (corfu-infoframe-scroll-up (- (or n 1)))) + (corfu-popupinfo-scroll-up (- (or n 1)))) -(defun corfu-infoframe--set-function (fun) +(defun corfu-popupinfo--set-function (fun) "Set popup documentation getter FUN." - (setq corfu-infoframe--function fun - corfu-infoframe--candidate nil - corfu-infoframe--toggle t) + (setq corfu-popupinfo--function fun + corfu-popupinfo--candidate nil + corfu-popupinfo--toggle t) (when-let (candidate (and (>= corfu--index 0) (nth corfu--index corfu--candidates))) - (corfu-infoframe--show candidate))) + (corfu-popupinfo--show candidate))) -(defun corfu-infoframe-documentation () +(defun corfu-popupinfo-documentation () "Show documentation in popup." (interactive) - (corfu-infoframe--set-function #'corfu-infoframe--get-documentation)) + (corfu-popupinfo--set-function #'corfu-popupinfo--get-documentation)) -(defun corfu-infoframe-location () +(defun corfu-popupinfo-location () "Show location in popup." (interactive) - (corfu-infoframe--set-function #'corfu-infoframe--get-location)) + (corfu-popupinfo--set-function #'corfu-popupinfo--get-location)) -(defun corfu-infoframe-toggle () - "Toggle the info frame display or hide. +(defun corfu-popupinfo-toggle () + "Toggle the info popup display or hide. -When using this command to manually hide the info frame, it will +When using this command to manually hide the info popup, it will not be displayed until this command is called again, even if -`corfu-infoframe-auto' is non-nil." +`corfu-popupinfo-auto' is non-nil." (interactive) (if-let ((candidate (and (>= corfu--index 0) (nth corfu--index corfu--candidates))) - ((setq corfu-infoframe--toggle (not (corfu-infoframe--visible-p))))) - (corfu-infoframe--show candidate) - (corfu-infoframe--hide))) + ((setq corfu-popupinfo--toggle (not (corfu-popupinfo--visible-p))))) + (corfu-popupinfo--show candidate) + (corfu-popupinfo--hide))) -(defun corfu-infoframe--exhibit (&rest _) - "Update the info frame automatically." +(defun corfu-popupinfo--exhibit (&rest _) + "Update the info popup automatically." (add-to-list 'minor-mode-overriding-map-alist - `(,#'corfu-infoframe-mode . ,corfu-infoframe-map)) + `(,#'corfu-popupinfo-mode . ,corfu-popupinfo-map)) (if (and (frame-live-p corfu--frame) (frame-visible-p corfu--frame) (>= corfu--index 0)) - (when (and corfu-infoframe-auto corfu-infoframe--toggle) - (when corfu-infoframe--auto-timer - (cancel-timer corfu-infoframe--auto-timer) - (setq corfu-infoframe--auto-timer nil)) + (when (and corfu-popupinfo-auto corfu-popupinfo--toggle) + (when corfu-popupinfo--auto-timer + (cancel-timer corfu-popupinfo--auto-timer) + (setq corfu-popupinfo--auto-timer nil)) (let ((candidate (nth corfu--index corfu--candidates))) - (if (or (= corfu-infoframe-delay 0) - (equal candidate corfu-infoframe--candidate)) - (corfu-infoframe--show candidate) - (if corfu-infoframe-hide - (corfu-infoframe--hide) - (corfu-infoframe--show corfu-infoframe--candidate)) - (setq corfu-infoframe--auto-timer - (run-at-time corfu-infoframe-delay nil - #'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) + (if (or (= corfu-popupinfo-delay 0) + (equal candidate corfu-popupinfo--candidate)) + (corfu-popupinfo--show candidate) + (if corfu-popupinfo-hide + (corfu-popupinfo--hide) + (corfu-popupinfo--show corfu-popupinfo--candidate)) + (setq corfu-popupinfo--auto-timer + (run-at-time corfu-popupinfo-delay nil + #'corfu-popupinfo--show candidate))))) + (corfu-popupinfo--hide))) + +(defun corfu-popupinfo--teardown () + "Teardown the info popup state." + (corfu-popupinfo--hide) + (mapc #'kill-local-variable corfu-popupinfo--state-vars) (setq minor-mode-overriding-map-alist - (assq-delete-all #'corfu-infoframe-mode + (assq-delete-all #'corfu-popupinfo-mode minor-mode-overriding-map-alist))) ;;;###autoload -(define-minor-mode corfu-infoframe-mode - "Corfu info frame minor mode." +(define-minor-mode corfu-popupinfo-mode + "Corfu info popup minor mode." :global t :group 'corfu (cond - (corfu-infoframe-mode - (advice-add #'corfu--exhibit :after #'corfu-infoframe--exhibit) - (advice-add #'corfu--teardown :before #'corfu-infoframe--teardown)) + (corfu-popupinfo-mode + (advice-add #'corfu--exhibit :after #'corfu-popupinfo--exhibit) + (advice-add #'corfu--teardown :before #'corfu-popupinfo--teardown)) (t - (advice-remove #'corfu--exhibit #'corfu-infoframe--exhibit) - (advice-remove #'corfu--teardown #'corfu-infoframe--teardown)))) + (advice-remove #'corfu--exhibit #'corfu-popupinfo--exhibit) + (advice-remove #'corfu--teardown #'corfu-popupinfo--teardown)))) ;; Emacs 28: Do not show Corfu commands with M-X -(dolist (sym '(corfu-infoframe-scroll-down corfu-infoframe-scroll-down - corfu-infoframe-documentation corfu-infoframe-location - corfu-infoframe-toggle)) +(dolist (sym '(corfu-popupinfo-scroll-down corfu-popupinfo-scroll-down + corfu-popupinfo-documentation corfu-popupinfo-location + corfu-popupinfo-toggle)) (put sym 'completion-predicate #'ignore)) -(provide 'corfu-infoframe) -;;; corfu-infoframe.el ends here +(provide 'corfu-popupinfo) +;;; corfu-popupinfo.el ends here |
