[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu e8f6e92ba9 5/6: Cleanup corfu-popupinfo--size
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu e8f6e92ba9 5/6: Cleanup corfu-popupinfo--size |
Date: |
Fri, 18 Nov 2022 09:57:26 -0500 (EST) |
branch: externals/corfu
commit e8f6e92ba9124edbc85bb6c60f5689e6b6f3c748
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Cleanup corfu-popupinfo--size
---
extensions/corfu-popupinfo.el | 42 +++++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index 51c913c190..dd0c5246e3 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -27,8 +27,8 @@
;;; Commentary:
;; NOTE: This extension has been added recently to Corfu. It is still
-;; experimental. The extension may get renamed and the public interface may
-;; change any time.
+;; experimental. The extension may get renamed and the public interface
+;; may change any time.
;;
;; Display a documentation popup for completion candidate when using
;; Corfu. The `corfu-popupinfo-mode' must be enabled globally. Set
@@ -180,27 +180,21 @@ See `frame-edges' for details.")
(buffer-string)))
(and (not (string-blank-p res)) res))))
-;; TODO get rid of optional arguments?
-(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)."
+;; TODO return pair, not list?
+(defun corfu-popupinfo--size ()
+ "Calculate popup size in the form of (width 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-popupinfo-resize)
- (list (or width max-width) (or height max-height))
- (pcase-let ((`(,win-width . ,win-height)
- (save-window-excursion
- (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)
- (* 2 max-width)
(* 2 max-height))))))
- (list (or width win-width) (or height win-height))))))
- (list (min popup-width max-width) (min popup-height max-height))))))
+ (if corfu-popupinfo-resize
+ (pcase-let ((`(,width . ,height)
+ (save-window-excursion
+ (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)
+ (* 2 max-width) (* 2
max-height))))))
+ (list (min width max-width) (min height max-height)))
+ (list max-width max-height))))
(defun corfu-popupinfo--frame-geometry (frame)
"Return position and size geometric attributes of FRAME.
@@ -297,8 +291,10 @@ the candidate popup, its value is 'bottom, 'top, 'right or
'left."
(apply #'corfu-popupinfo--display-area-vertical
(corfu-popupinfo--size)))
(t
- (pcase-let* ((`(,width ,height) ;; popup inner width and height
- (corfu-popupinfo--size width height))
+ (pcase-let* ((`(,width ,height)
+ (if (and width height)
+ (list width height)
+ (corfu-popupinfo--size)))
((and h-a `(,_h-x ,_h-y ,h-w ,h-h ,_h-d))
(corfu-popupinfo--display-area-horizontal width height))
((and v-a `(,_v-x ,_v-y ,v-w ,v-h ,_v-d))
- [elpa] externals/corfu updated (21214caa8e -> 9f0cad7cd2), ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 709ca22543 1/6: Fix corfu-infoframe placement (Fix #250), ELPA Syncer, 2022/11/18
- [elpa] externals/corfu edf5e1ad3d 2/6: Rename extension once more, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 51004b233a 4/6: corfu-popupinfo: Expand note ; ), ELPA Syncer, 2022/11/18
- [elpa] externals/corfu e8f6e92ba9 5/6: Cleanup corfu-popupinfo--size,
ELPA Syncer <=
- [elpa] externals/corfu e3210e0b22 3/6: Extract buffer parameters, ELPA Syncer, 2022/11/18
- [elpa] externals/corfu 9f0cad7cd2 6/6: Remove unnecessary get-buffer calls, ELPA Syncer, 2022/11/18