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

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

[elpa] externals/ivy-posframe 7ea96ce 055/195: Merge pull request #19 fr


From: Feng Shu
Subject: [elpa] externals/ivy-posframe 7ea96ce 055/195: Merge pull request #19 from abo-abo/master
Date: Sat, 3 Oct 2020 07:11:44 -0400 (EDT)

branch: externals/ivy-posframe
commit 7ea96ce97857b4d4898e7a908429e61a714b412a
Merge: 9982c6d 3784f59
Author: tumashu <tumashu@163.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #19 from abo-abo/master
    
    Simplify ivy-postframe-avy
---
 ivy-posframe.el | 49 +++++--------------------------------------------
 1 file changed, 5 insertions(+), 44 deletions(-)

diff --git a/ivy-posframe.el b/ivy-posframe.el
index 0a323d1..8304c6a 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -178,7 +178,7 @@ This variable is useful for `ivy-posframe-read-action' .")
   "Show STR in ivy's posframe."
   (if (not (ivy-posframe-workable-p))
       (ivy-display-function-fallback str)
-    (with-selected-window (ivy--get-window ivy-last)
+    (with-ivy-window
       (posframe-show
        ivy-posframe-buffer
        :font ivy-posframe-font
@@ -287,13 +287,6 @@ selection, non-nil otherwise."
                (setcar actions (1+ action-idx))
                (ivy-set-action actions)))))))
 
-(defun ivy-posframe--avy-action (pt)
-  "Finish ivy session with the candidate at PT."
-  (with-current-buffer ivy-posframe-buffer
-    (ivy--done
-     (substring-no-properties
-      (nth (- (line-number-at-pos pt) 2) ivy--old-cands)))))
-
 (defun ivy-posframe--window ()
   "Return the posframe window displaying `ivy-posframe-buffer'."
   (frame-selected-window
@@ -302,46 +295,14 @@ selection, non-nil otherwise."
 
 (defvar avy-all-windows)
 (defvar avy-keys)
-(defvar avy-keys-alist)
 (defvar avy-style)
-(defvar avy-styles-alist)
-(defvar avy-action)
-(declare-function avy--process "avy")
-(declare-function avy--style-fn "avy")
+
 (defun ivy-posframe-avy ()
   "Jump to one of the current ivy candidates."
   (interactive)
-  (unless (require 'avy nil 'noerror)
-    (error "Package avy isn't installed"))
-  (unless (boundp 'avy-pre-action)
-    (error "A newer version of avy is required for this command"))
-  (let* ((avy-all-windows nil)
-         (avy-keys (or (cdr (assq 'ivy-avy avy-keys-alist))
-                       avy-keys))
-         (avy-style (or (cdr (assq 'ivy-avy
-                                   avy-styles-alist))
-                        avy-style))
-         ;; prevent default pre action, which calls
-         ;; `select-frame-set-input-focus', deselecting the minibuffer and
-         ;; causing `ivy-posframe-cleanup' to run prematurely
-         (avy-pre-action #'ignore)
-         (window (ivy-posframe--window))
-         candidates)
-    (with-current-buffer ivy-posframe-buffer
-      (save-excursion
-        (save-restriction
-          (narrow-to-region
-           (window-start window)
-           (window-end window))
-          (goto-char (point-min))
-          (forward-line)
-          (while (< (point) (point-max))
-            (push (cons (point) window) candidates)
-            (forward-line)))))
-    (setq avy-action #'ivy-posframe--avy-action)
-    (avy--process
-     (nreverse candidates)
-     (avy--style-fn avy-style))))
+  (let ((avy-pre-action #'ignore))
+    (with-selected-window (ivy-posframe--window)
+      (ivy-avy))))
 
 (declare-function avy--make-backgrounds "avy")
 (declare-function avy-window-list "avy")



reply via email to

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