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

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

[elpa] externals/ivy-posframe e0247bf 035/195: split ivy-posframe-setup


From: Feng Shu
Subject: [elpa] externals/ivy-posframe e0247bf 035/195: split ivy-posframe-setup to ivy-posframe-init and ivy-posframe-setup
Date: Sat, 3 Oct 2020 07:11:40 -0400 (EDT)

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

    split ivy-posframe-setup to ivy-posframe-init and ivy-posframe-setup
---
 ivy-posframe.el | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/ivy-posframe.el b/ivy-posframe.el
index 701d86b..33b791b 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -199,23 +199,6 @@ This variable is useful for `ivy-posframe-read-action' .")
                 emacs-basic-display
                 (not (display-graphic-p))))))
 
-(defun ivy-posframe-setup ()
-  "Setup ivy-posframe."
-  (interactive)
-  ;; Regedit all display functions of ivy-posframe
-  ;; to `ivy-display-functions-props'.
-  (mapatoms
-   #'(lambda (func)
-       (when (and (functionp func)
-                  (string-match-p "^ivy-posframe-display" (symbol-name func))
-                  (not (assq func ivy-display-functions-props)))
-         (push `(,func :cleanup ivy-posframe-cleanup)
-               ivy-display-functions-props))))
-  ;; Re-configure ivy keymap.
-  (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))
-
 (defun ivy-posframe-dispatching-done ()
   "Select one of the available actions and call `ivy-done'."
   (interactive)
@@ -267,6 +250,28 @@ selection, non-nil otherwise."
   (interactive)
   (message "ivy-posframe: ivy-avy is not supported at the moment."))
 
+;;;###autoload
+(defun ivy-posframe-setup ()
+  "Setup ivy-posframe."
+  (interactive)
+  (require 'ivy)
+  (ivy-posframe-init)
+  (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))
+
+(defun ivy-posframe-init ()
+  "Add all display functions of ivy-posframe to
+`ivy-display-functions-props'."
+  (mapatoms
+   #'(lambda (func)
+       (when (and (functionp func)
+                  (string-match-p "^ivy-posframe-display" (symbol-name func))
+                  (not (assq func ivy-display-functions-props)))
+         (push `(,func :cleanup ivy-posframe-cleanup)
+               ivy-display-functions-props)))))
+
+(ivy-posframe-init)
 
 (provide 'ivy-posframe)
 



reply via email to

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