[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-posframe 02a357d 104/195: define ivy-posframe-mode
From: |
Feng Shu |
Subject: |
[elpa] externals/ivy-posframe 02a357d 104/195: define ivy-posframe-mode instead of ivy-posframe-enable |
Date: |
Sat, 3 Oct 2020 07:11:54 -0400 (EDT) |
branch: externals/ivy-posframe
commit 02a357d0d414c5ce6c5fdbb1846cefafafcf884a
Author: conao3 <conao3@gmail.com>
Commit: conao3 <conao3@gmail.com>
define ivy-posframe-mode instead of ivy-posframe-enable
---
ivy-posframe.el | 45 ++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/ivy-posframe.el b/ivy-posframe.el
index 365d6c7..6e6a20f 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -60,7 +60,7 @@
;; ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-bottom-left)
;; ;; (setq ivy-display-function #'ivy-posframe-display-at-window-bottom-left)
;; ;; (setq ivy-display-function #'ivy-posframe-display-at-point)
-;; (ivy-posframe-enable)
+;; (ivy-posframe-mode t)
;; #+END_EXAMPLE
;; *** Per-command mode.
;; #+BEGIN_EXAMPLE
@@ -69,7 +69,7 @@
;; (push '(counsel-M-x . ivy-posframe-display-at-window-bottom-left)
ivy-display-functions-alist)
;; (push '(complete-symbol . ivy-posframe-display-at-point)
ivy-display-functions-alist)
;; (push '(swiper . ivy-posframe-display-at-point) ivy-display-functions-alist)
-;; (ivy-posframe-enable)
+;; (ivy-posframe-mode t)
;; #+END_EXAMPLE
;;
;; NOTE: Using swiper as example: swiper's display function *only*
@@ -86,7 +86,7 @@
;; #+BEGIN_EXAMPLE
;; (require 'ivy-posframe)
;; (push '(t . ivy-posframe-display) ivy-display-functions-alist)
-;; (ivy-posframe-enable)
+;; (ivy-posframe-mode t)
;; #+END_EXAMPLE
;; ** Tips
@@ -107,7 +107,7 @@
;; #+BEGIN_EXAMPLE
;; (defun ivy-posframe-display-at-XXX (str)
;; (ivy-posframe--display str #'your-own-poshandler-function))
-;; (ivy-posframe-enable) ; This line is needed.
+;; (ivy-posframe-mode t) ; This line is needed.
;; #+END_EXAMPLE
;;; Code:
@@ -452,29 +452,32 @@ selection, non-nil otherwise."
(ivy-minibuffer-map [remap swiper-avy] ivy-posframe-swiper-avy)))
;;;###autoload
-(defun ivy-posframe-enable ()
- "Enable ivy-posframe."
- (interactive)
- (eval
- `(progn
- (mapcar (lambda (fn)
- `(push `(,fn :cleanup ivy-posframe-cleanup)
ivy-display-functions-props))
- ivy-posframe-display-functions)
- (mapcar (lambda (elm)
- `(advice-add ',(car elm) :around #',(cdr elm)))
- ivy-posframe-advice-alist)
- (mapcar (lambda (elm)
- (let ((map (nth 0 elm)) (key (nth 1 elm)) (cmd (nth 2 elm)))
- `(define-key ,map ,key ',cmd)))
- ivy-posframe-keybind-list)))
- (message "ivy-posframe is enabled, disabling it need to reboot emacs."))
+(define-minor-mode ivy-posframe-mode
+ "Display ivy via posframe."
+ :init-value nil
+ :global t
+ :lighter " ivy-pf"
+ :group 'ivy-posframe
+ (if ivy-posframe-mode
+ (eval
+ `(progn
+ (mapcar (lambda (fn)
+ `(push `(,fn :cleanup ivy-posframe-cleanup)
ivy-display-functions-props))
+ ivy-posframe-display-functions)
+ (mapcar (lambda (elm)
+ `(advice-add ',(car elm) :around #',(cdr elm)))
+ ivy-posframe-advice-alist)
+ (mapcar (lambda (elm)
+ (let ((map (nth 0 elm)) (key (nth 1 elm)) (cmd (nth 2
elm)))
+ `(define-key ,map ,key ',cmd)))
+ ivy-posframe-keybind-list)))))
;;;###autoload
(defun ivy-posframe-demo ()
"Toggle a demo config of ivy-posframe.
This function is ONLY used to test ivy-posframe."
(interactive)
- (ivy-posframe-enable)
+ (ivy-posframe-mode t)
(let ((config '(t . ivy-posframe-display-at-frame-center)))
(if (member config ivy-display-functions-alist)
(progn
- [elpa] externals/ivy-posframe 1a7f2f0 107/195: move ivy-posframe-display-functions to variables section, (continued)
- [elpa] externals/ivy-posframe 1a7f2f0 107/195: move ivy-posframe-display-functions to variables section, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 95c1028 177/195: ivy-display-function -> ivy--display-function, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe aae7322 119/195: use ivy-posframe-mode-map instead of define-key, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 35d47bd 117/195: refine document, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 7dc84ee 152/195: Fix2 First line disappears with the specific condition. #47, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe d35af4f 144/195: handle ivy-display-function again, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 8902638 100/195: define ivy-posframe-adbice-alist, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 212eaa1 138/195: indent ivy-posframe-mode, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe b934152 125/195: move variables section above advice section, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 9e0c6da 118/195: generate readme, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 02a357d 104/195: define ivy-posframe-mode instead of ivy-posframe-enable,
Feng Shu <=
- [elpa] externals/ivy-posframe aea9074 122/195: add ivy-posframe--read advice, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 76350e7 146/195: Update README, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe c4091c3 120/195: remove unnesessary code, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe e76a15d 162/195: Merge pull request #53 from gagbo/patch-1, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 83657be 114/195: add display-functions-alist to restore ivy variable, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 27e3cec 176/195: Try to fix Minibuffer is hiding always #66, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe c43acf3 132/195: alias ivy-posframe-enable as ivy-posframe-mode, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 3c3740e 142/195: Add ivy-posframe-lighter, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 6d697ff 190/195: Try to fix: Posframe max-width? #82, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe ae9bafe 191/195: (defvar avy-pre-action), Feng Shu, 2020/10/03