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

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

[elpa] externals/ivy-posframe 1651770 012/195: Update


From: Feng Shu
Subject: [elpa] externals/ivy-posframe 1651770 012/195: Update
Date: Sat, 3 Oct 2020 07:11:35 -0400 (EDT)

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

    Update
---
 README.md       | 52 ++++++++++++++++++++++++++++++++++++++++++----------
 ivy-posframe.el | 55 ++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 84 insertions(+), 23 deletions(-)

diff --git a/README.md b/README.md
index b2ec43e..923fc91 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,66 @@
 
 # &#30446;&#24405;
 
-1.  [ivy-posframe README](#org62b81db)
-    1.  [What is ivy-posframe](#org28920fa)
-    2.  [How to use ivy-posframe](#orgf87cbce)
+1.  [ivy-posframe README](#org0fcd3f6)
+    1.  [What is ivy-posframe](#org5941743)
+    2.  [How to use ivy-posframe](#orgb557f45)
+        1.  [How to enable ivy-posframe](#org9056741)
+        2.  [Window-buttom-left style](#org3ce6114)
+        3.  [Window-center style](#orgadbea28)
 
 
-<a id="org62b81db"></a>
+<a id="org0fcd3f6"></a>
 
 # ivy-posframe README
 
 
-<a id="org28920fa"></a>
+<a id="org5941743"></a>
 
 ## What is ivy-posframe
 
 ivy-posframe is a ivy extension, which let ivy use posframe
 to show its candidate menu.
 
+
+<a id="orgb557f45"></a>
+
+## How to use ivy-posframe
+
+
+<a id="org9056741"></a>
+
+### How to enable ivy-posframe
+
+1.  Global mode
+
+        (require 'ivy-posframe)
+        (setq ivy-display-function #'ivy-posframe-display)
+2.  Per-command mode.
+
+        (require 'ivy-posframe)
+        (push '(counsel-M-x . ivy-posframe-display) 
ivy-display-functions-alist)
+3.  Fallback mode
+
+        (require 'ivy-posframe)
+        (push '(t . ivy-posframe-display) ivy-display-functions-alist)
+
+
+<a id="org3ce6114"></a>
+
+### Window-buttom-left style
+
+    (setq ivy-posframe-style 'window-buttom-left)
+
 ![img](./snapshots/ivy-posframe1.gif)
 
-![img](./snapshots/ivy-posframe2.gif)
 
+<a id="orgadbea28"></a>
 
-<a id="orgf87cbce"></a>
+### Window-center style
 
-## How to use ivy-posframe
+    (setq ivy-posframe-style 'window-center)
 
-    (require 'ivy-posframe)
-    (ivy-posframe-mode 1)
+![img](./snapshots/ivy-posframe2.gif)
 
 
 
diff --git a/ivy-posframe.el b/ivy-posframe.el
index 19fbba3..f1ecc9b 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -31,17 +31,42 @@
 ;; ivy-posframe is a ivy extension, which let ivy use posframe
 ;; to show its candidate menu.
 
-;; [[./snapshots/ivy-posframe1.gif]]
+;; ** How to use ivy-posframe
 
-;; [[./snapshots/ivy-posframe2.gif]]
+;; *** How to enable ivy-posframe
+
+;; 1. Global mode
+;;    #+BEGIN_EXAMPLE
+;;    (require 'ivy-posframe)
+;;    (setq ivy-display-function #'ivy-posframe-display)
+;;    #+END_EXAMPLE
+;; 2. Per-command mode.
+;;    #+BEGIN_EXAMPLE
+;;    (require 'ivy-posframe)
+;;    (push '(counsel-M-x . ivy-posframe-display) ivy-display-functions-alist)
+;;    #+END_EXAMPLE
+;; 3. Fallback mode
+;;    #+BEGIN_EXAMPLE
+;;    (require 'ivy-posframe)
+;;    (push '(t . ivy-posframe-display) ivy-display-functions-alist)
+;;    #+END_EXAMPLE
+
+;; *** Window-buttom-left style
+;; #+BEGIN_EXAMPLE
+;; (setq ivy-posframe-style 'window-buttom-left)
+;; #+END_EXAMPLE
 
-;; ** How to use ivy-posframe
+;; [[./snapshots/ivy-posframe1.gif]]
 
+;; *** Window-center style
 ;; #+BEGIN_EXAMPLE
-;; (require 'ivy-posframe)
-;; (ivy-posframe-mode 1)
+;; (setq ivy-posframe-style 'window-center)
 ;; #+END_EXAMPLE
 
+;; [[./snapshots/ivy-posframe2.gif]]
+
+
+
 ;;; Code:
 ;; * ivy-posframe's code
 (require 'cl-lib)
@@ -62,12 +87,8 @@
 Using current frame's font if it it nil."
   :group 'ivy-posframe)
 
-(defcustom ivy-posframe-poshandler nil
-  "The posframe poshandler used by ivy-posframe.
-When nil, use `posframe-poshandler-window-bottom-left-corner'
-as fallback.
-
-More details can be found in docstring of `posframe-show'."
+(defcustom ivy-posframe-style 'window-buttom-left
+  "The style of ivy-posframe."
   :group 'ivy-posframe)
 
 (defface ivy-posframe
@@ -78,6 +99,14 @@ More details can be found in docstring of `posframe-show'."
 (defvar ivy-posframe-buffer " *ivy-posframe-buffer*"
   "The buffer which used by ivy-posframe.")
 
+(defvar ivy-posframe-style-alist
+  '((window-center . posframe-poshandler-window-center)
+    (frame-center  . posframe-poshandler-frame-center)
+    (window-buttom-left . posframe-poshandler-window-bottom-left-corner)
+    (frame-buttom-left . posframe-poshandler-frame-bottom-left-corner)
+    (point . posframe-poshandler-point-bottom-left-corner))
+  "Alist of ivy posframe styles.")
+
 (defun ivy-posframe-display (str)
   "Show ivy's posframe."
   (if (not (ivy-posframe-workable-p))
@@ -88,8 +117,8 @@ More details can be found in docstring of `posframe-show'."
        :font ivy-posframe-font
        :string (concat ivy--prompt ivy-text str)
        :position (point)
-       :poshandler (or ivy-posframe-poshandler
-                       #'posframe-poshandler-window-bottom-left-corner)
+       :poshandler (cdr (assq ivy-posframe-style
+                              ivy-posframe-style-alist))
        :background-color (face-attribute 'ivy-posframe :background)
        :foreground-color (face-attribute 'ivy-posframe :foreground)
        :height ivy-height



reply via email to

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