[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 @@
# 目录
-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
- [elpa] branch externals/ivy-posframe created (now d539ac2), Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe d6fc7c6 001/195: Init commit, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 8861e54 002/195: Use ivy-display-functions-props, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 229caae 003/195: update, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 3bc6301 004/195: Add ivy-posframe-workable-p, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 2733fe1 010/195: Set :position to (point)., Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe f287da7 006/195: Add ivy-posframe-mode, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 990b9b4 007/195: Update, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 8d0b0ae 008/195: Update, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe fc0820a 009/195: Update, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 1651770 012/195: Update,
Feng Shu <=
- [elpa] externals/ivy-posframe 6494b38 005/195: Add ivy-posframe-mode, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 8a54dbb 011/195: Use ivy-display-function-fallback, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 8a3ecb3 014/195: package-require ivy, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 0136107 015/195: Remove ivy-posframe-mode, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 2546238 016/195: reuse minibuffer's ivy prompt, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 9db2b75 017/195: Update README, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 550c322 018/195: Fix warn, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe c36250a 013/195: Update README, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe cef74e6 021/195: Different command can set different ivy-posframe display function, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 5482c07 024/195: Update README, Feng Shu, 2020/10/03