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

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

[elpa] externals/vertico-posframe 1b7b64af1a 2/2: Add vertico-posframe--


From: ELPA Syncer
Subject: [elpa] externals/vertico-posframe 1b7b64af1a 2/2: Add vertico-posframe--multiform-function
Date: Wed, 15 Nov 2023 21:58:45 -0500 (EST)

branch: externals/vertico-posframe
commit 1b7b64af1abbf506b2162ff388be6b0e6b864557
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Add vertico-posframe--multiform-function
---
 vertico-posframe.el | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/vertico-posframe.el b/vertico-posframe.el
index 2b04e9a147..789e18bde5 100644
--- a/vertico-posframe.el
+++ b/vertico-posframe.el
@@ -186,18 +186,20 @@ minibuffer will not be hided by minibuffer-cover."
 (define-minor-mode vertico-posframe-mode
   "Display Vertico in posframe instead of the minibuffer."
   :global t
-  (cond
-   (vertico-posframe-mode
-    (when (not (posframe-workable-p))
-      (funcall (buffer-local-value 'vertico-posframe-fallback-mode 
(current-buffer)) 1)))
-   (t
-    (if (not (posframe-workable-p))
-        (funcall (buffer-local-value 'vertico-posframe-fallback-mode 
(current-buffer)) -1)
-      ;; When vertico-posframe-mode is disabled, hide posframe and let
-      ;; the contents of minibuffer show again, this approach let
-      ;; vertico-posframe works with vertico multiform toggle.
-      (set-window-vscroll (active-minibuffer-window) 0)
-      (posframe-hide vertico-posframe--buffer)))))
+  (if vertico-posframe-mode
+      (unless (posframe-workable-p)
+        (funcall (buffer-local-value 'vertico-posframe-fallback-mode 
(current-buffer)) 1))
+    (if (posframe-workable-p)
+        (vertico-posframe--multiform-function)
+      (funcall (buffer-local-value 'vertico-posframe-fallback-mode 
(current-buffer)) -1))))
+
+(defun vertico-posframe--multiform-function ()
+  "Function work with `'vertico-multiform-mode'.
+When `vertico-posframe-mode' is disabled, hide posframe and let
+the contents of minibuffer show again, this approach let
+vertico-posframe works with vertico multiform toggle."
+  (set-window-vscroll (active-minibuffer-window) 0)
+  (posframe-hide vertico-posframe--buffer))
 
 ;; Support vertico-multiform
 (cl-pushnew 'vertico-posframe-mode vertico-multiform--display-modes)



reply via email to

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