emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/corfu f92c4c3fa4 3/5: Refactored corfu--make-frame


From: ELPA Syncer
Subject: [elpa] externals/corfu f92c4c3fa4 3/5: Refactored corfu--make-frame
Date: Thu, 17 Nov 2022 15:57:28 -0500 (EST)

branch: externals/corfu
commit f92c4c3fa42c8f721371c3c2fb975bdbf0c57249
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Refactored corfu--make-frame
---
 corfu.el                      | 38 +++++++++++++++++++-------------------
 extensions/corfu-doc-popup.el |  4 ++--
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/corfu.el b/corfu.el
index 45586e80c2..214239a62f 100644
--- a/corfu.el
+++ b/corfu.el
@@ -388,9 +388,8 @@ The completion backend can override this with
 
 ;; Function adapted from posframe.el by tumashu
 (defvar x-gtk-resize-child-frames) ;; Not present on non-gtk builds
-(defun corfu--make-frame (frame params buffer x y width height)
-  "Make child frame from BUFFER and show it at X/Y with WIDTH/HEIGHT.
-
+(defun corfu--make-frame (frame params x y width height buffer)
+  "Show BUFFER in child frame at X/Y with WIDTH/HEIGHT.
 PARAMS are frame parameters and FRAME is the existing frame."
   (when-let (timer (and frame (frame-parameter frame 'corfu--hide-timer)))
     (cancel-timer timer)
@@ -485,23 +484,24 @@ A scroll bar is displayed from LO to LO+BAR."
          (y (if (> (+ yb (* corfu-count ch) ch ch) (frame-pixel-height))
                 (- yb height ch 1)
               yb))
-         (row 0)
-         (buffer (corfu--make-buffer
-                  " *corfu*"
-                  (mapconcat (lambda (line)
-                               (let ((str (concat marginl line
-                                                  (if (and lo (<= lo row (+ lo 
bar)))
-                                                      sbar
-                                                    marginr))))
-                                 (when (eq row curr)
-                                   (add-face-text-property
-                                    0 (length str) 'corfu-current 'append str))
-                                 (setq row (1+ row))
-                                 str))
-                             lines "\n"))))
+         (row 0))
     (setq corfu--frame
-          (corfu--make-frame corfu--frame corfu--frame-parameters buffer
-                             x y width height))))
+          (corfu--make-frame
+           corfu--frame corfu--frame-parameters
+           x y width height
+           (corfu--make-buffer
+            " *corfu*"
+            (mapconcat (lambda (line)
+                         (let ((str (concat marginl line
+                                            (if (and lo (<= lo row (+ lo bar)))
+                                                sbar
+                                              marginr))))
+                           (when (eq row curr)
+                             (add-face-text-property
+                              0 (length str) 'corfu-current 'append str))
+                           (setq row (1+ row))
+                           str))
+                       lines "\n"))))))
 
 (defun corfu--hide-frame-deferred (frame)
   "Deferred hiding of child FRAME."
diff --git a/extensions/corfu-doc-popup.el b/extensions/corfu-doc-popup.el
index dba9e387e3..e2dc603eb3 100644
--- a/extensions/corfu-doc-popup.el
+++ b/extensions/corfu-doc-popup.el
@@ -373,8 +373,8 @@ it should be compared with the value recorded by 
`corfu--index'."
             (setq corfu-doc-popup--frame
                   (corfu--make-frame corfu-doc-popup--frame
                                      corfu-doc-popup--frame-parameters
-                                     (get-buffer " *corfu-doc-popup*")
-                                     area-x area-y area-w area-h)
+                                     area-x area-y area-w area-h
+                                     (get-buffer " *corfu-doc-popup*"))
                   corfu-doc-popup--direction area-d)))
         (if doc-updated-p
             (setq corfu-doc-popup--candidate candidate



reply via email to

[Prev in Thread] Current Thread [Next in Thread]