[Top][All Lists]

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

[elpa] externals/ivy-posframe 3d98dbd 048/195: Add ivy-posframe-hide-min

From: Feng Shu
Subject: [elpa] externals/ivy-posframe 3d98dbd 048/195: Add ivy-posframe-hide-minibuffer feature, fix #12
Date: Sat, 3 Oct 2020 07:11:43 -0400 (EDT)

branch: externals/ivy-posframe
commit 3d98dbde1d9b1b170b87828d34d068c358de591d
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Add ivy-posframe-hide-minibuffer feature, fix #12
 ivy-posframe.el | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/ivy-posframe.el b/ivy-posframe.el
index 7931a2d..ce7c97f 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -144,6 +144,11 @@ When 0, no border is showed."
   :group 'ivy-posframe
   :type 'number)
+(defcustom ivy-posframe-hide-minibuffer nil
+  "Hide input of minibuffer when using ivy-posframe."
+  :group 'ivy-posframe
+  :type 'boolean)
 (defcustom ivy-posframe-parameters nil
   "The frame parameters used by ivy-posframe."
   :group 'ivy-posframe
@@ -287,6 +292,17 @@ selection, non-nil otherwise."
   (message "ivy-posframe: ivy-avy is not supported at the moment."))
+(defun ivy-posframe--minibuffer-setup (orig-func)
+  "Advice function of `ivy--minibuffer-setup'."
+  (funcall orig-func)
+  (when ivy-posframe-hide-minibuffer
+    (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
+      (overlay-put ov 'window (selected-window))
+      (overlay-put ov 'face
+                   (let ((bg-color (face-background 'default nil)))
+                     `(:background ,bg-color :foreground ,bg-color)))
+      (setq-local cursor-type nil))))
 (defun ivy-posframe-enable ()
   "Enable ivy-posframe."
@@ -296,7 +312,8 @@ selection, non-nil otherwise."
   (define-key ivy-minibuffer-map (kbd "C-M-a") 'ivy-posframe-read-action)
   (define-key ivy-minibuffer-map (kbd "M-o") 'ivy-posframe-dispatching-done)
   (define-key ivy-minibuffer-map (kbd "C-'") 'ivy-posframe-avy)
-  (message "ivy-posframe is enabled."))
+  (advice-add 'ivy--minibuffer-setup :around #'ivy-posframe--minibuffer-setup)
+  (message "ivy-posframe is enabled, disabling it need to reboot emacs."))
 (defun ivy-posframe-setup ()
   "Add all display functions of ivy-posframe to

reply via email to

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