branch: externals/ivy-posframe
commit 061a12550c5b7c75b345c4005c80b67436693608
Author: Feng Shu <[email protected]>
Commit: Feng Shu <[email protected]>
Re-add ivy-posframe-style for compatible
---
README.md | 24 ++++++++++++------------
ivy-posframe.el | 15 ++++++++++++---
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index ba5e89c..296cb54 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,19 @@
# 目录
-1. [ivy-posframe README](#orgad72029)
- 1. [What is ivy-posframe](#orgf3fce48)
- 2. [Display functions](#org1420034)
- 3. [How to enable ivy-posframe](#orgcd8666c)
- 4. [How to custom your ivy-posframe style](#org7c1f241)
+1. [ivy-posframe README](#orgcc900c2)
+ 1. [What is ivy-posframe](#org5f83be3)
+ 2. [Display functions](#org24f03db)
+ 3. [How to enable ivy-posframe](#orgcedf7a7)
+ 4. [How to custom your ivy-posframe style](#org7b3c825)
-<a id="orgad72029"></a>
+<a id="orgcc900c2"></a>
# ivy-posframe README
-<a id="orgf3fce48"></a>
+<a id="org5f83be3"></a>
## What is ivy-posframe
@@ -23,7 +23,7 @@ to show its candidate menu.
NOTE: ivy-posframe requires Emacs 26
-<a id="org1420034"></a>
+<a id="org24f03db"></a>
## Display functions
@@ -39,7 +39,7 @@ NOTE: ivy-posframe requires Emacs 26

-<a id="orgcd8666c"></a>
+<a id="orgcedf7a7"></a>
## How to enable ivy-posframe
@@ -64,15 +64,15 @@ NOTE: ivy-posframe requires Emacs 26
(push '(t . ivy-posframe-display) ivy-display-functions-alist)
-<a id="org7c1f241"></a>
+<a id="org7b3c825"></a>
## How to custom your ivy-posframe style
The simplest way is:
(defun ivy-posframe-display-at-XXX (str)
- (ivy-posframe-display str 'your-own-poshandler-function))
- (ivy-posframe-setup) ; This line is need.
+ (ivy-posframe--display str #'your-own-poshandler-function))
+ (ivy-posframe-setup) ; This line is needed.
diff --git a/ivy-posframe.el b/ivy-posframe.el
index 622ba41..9f2d8bf 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -76,8 +76,8 @@
;; The simplest way is:
;; ;; #+BEGIN_EXAMPLE
;; (defun ivy-posframe-display-at-XXX (str)
-;; (ivy-posframe-display str 'your-own-poshandler-function))
-;; (ivy-posframe-setup) ; This line is need.
+;; (ivy-posframe--display str #'your-own-poshandler-function))
+;; (ivy-posframe-setup) ; This line is needed.
;; ;; #+END_EXAMPLE
;;; Code:
@@ -91,6 +91,11 @@
:group 'ivy
:prefix "ivy-posframe")
+(defcustom ivy-posframe-style 'window-bottom-left
+ "The style of ivy-posframe."
+ :group 'ivy-posframe
+ :type 'string)
+
(defcustom ivy-posframe-font nil
"The font used by ivy-posframe.
When nil, Using current frame's font as fallback."
@@ -128,7 +133,11 @@ When nil, Using current frame's font as fallback."
:min-width 50))))
(defun ivy-posframe-display (str)
- (ivy-posframe--display str #'posframe-poshandler-frame-bottom-left-corner))
+ (let ((func (intern (format "ivy-posframe-display-at-%s"
+ ivy-posframe-style))))
+ (if (functionp func)
+ (funcall func str)
+ (ivy-posframe-display-at-frame-bottom-left str))))
(defun ivy-posframe-display-at-window-center (str)
(ivy-posframe--display str #'posframe-poshandler-window-center))