[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-posframe 4474956 194/195: let ivy-posframe-swiper-a
From: |
Feng Shu |
Subject: |
[elpa] externals/ivy-posframe 4474956 194/195: let ivy-posframe-swiper-avy work when do not use ivy-posframe function |
Date: |
Sat, 3 Oct 2020 07:12:12 -0400 (EDT) |
branch: externals/ivy-posframe
commit 44749562a9e68bd43ccaa225b31311476fab1251
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
let ivy-posframe-swiper-avy work when do not use ivy-posframe function
---
ivy-posframe.el | 74 ++++++++++++++++++++++++++++++++-------------------------
1 file changed, 41 insertions(+), 33 deletions(-)
diff --git a/ivy-posframe.el b/ivy-posframe.el
index e459cc1..e0c3f0a 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -451,39 +451,47 @@ selection, non-nil otherwise."
(defun ivy-posframe-swiper-avy ()
"Jump to one of the current swiper candidates."
(interactive)
- (unless (require 'avy nil 'noerror)
- (error "Package avy isn't installed"))
- (unless (require 'avy nil 'noerror)
- (error "Package avy isn't installed"))
- (cl-case (length ivy-text)
- (0
- (user-error "Need at least one char of input"))
- (1
- (let ((swiper-min-highlight 1))
- (swiper--update-input-ivy))))
- (unless (string= ivy-text "")
- (let ((candidate (ivy-posframe--swiper-avy-candidate)))
- (cond ((eq (cdr candidate) (ivy-posframe--window))
- (let ((cand-text (with-current-buffer ivy-posframe-buffer
- (save-excursion
- (goto-char (car candidate))
- (buffer-substring
- (line-beginning-position)
- (line-end-position))))))
- (ivy-set-index
- ;; cand-text may include "> ", using a hack way
- ;; to deal with it.
- (or (cl-some (lambda (n)
- (cl-position (substring cand-text n)
ivy--old-cands :test #'string=))
- '(0 1 2 3 4))
- 0))
- (ivy--exhibit)
- (ivy-done)
- (ivy-call)))
- ((or (consp candidate)
- (number-or-marker-p candidate))
- (ivy-quit-and-run
- (avy-action-goto (avy-candidate-beg candidate))))))))
+ (if (not (string-match-p "^ivy-posframe-display"
+ (symbol-name ivy--display-function)))
+ ;; if swiper is not use ivy-posframe's display function.
+ ;; call `swiper-avy'.
+
+ ;; FIXME: This assume all ivy-posframe display functions are
+ ;; prefixed with ivy-posframe-display.
+ (swiper-avy)
+ (unless (require 'avy nil 'noerror)
+ (error "Package avy isn't installed"))
+ (unless (require 'avy nil 'noerror)
+ (error "Package avy isn't installed"))
+ (cl-case (length ivy-text)
+ (0
+ (user-error "Need at least one char of input"))
+ (1
+ (let ((swiper-min-highlight 1))
+ (swiper--update-input-ivy))))
+ (unless (string= ivy-text "")
+ (let ((candidate (ivy-posframe--swiper-avy-candidate)))
+ (cond ((eq (cdr candidate) (ivy-posframe--window))
+ (let ((cand-text (with-current-buffer ivy-posframe-buffer
+ (save-excursion
+ (goto-char (car candidate))
+ (buffer-substring
+ (line-beginning-position)
+ (line-end-position))))))
+ (ivy-set-index
+ ;; cand-text may include "> ", using a hack way
+ ;; to deal with it.
+ (or (cl-some (lambda (n)
+ (cl-position (substring cand-text n)
ivy--old-cands :test #'string=))
+ '(0 1 2 3 4))
+ 0))
+ (ivy--exhibit)
+ (ivy-done)
+ (ivy-call)))
+ ((or (consp candidate)
+ (number-or-marker-p candidate))
+ (ivy-quit-and-run
+ (avy-action-goto (avy-candidate-beg candidate)))))))))
;;; Variables
- [elpa] externals/ivy-posframe 57c53ef 173/195: Merge pull request #59 from conao3/fix-ivy-buffer-missing, (continued)
- [elpa] externals/ivy-posframe 57c53ef 173/195: Merge pull request #59 from conao3/fix-ivy-buffer-missing, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 1794866 170/195: not use let variable to make code simple, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 65bc90d 151/195: fix minor mode option, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 2f2c7f6 154/195: Merge pull request #48 from tttuuu888/work-list, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 187288c 167/195: accept declare form, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe d9ceee9 181/195: Fix: Regression : not usable with tty and gui emacsen under same daemon #69, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe aadadf1 185/195: Merge pull request #73 from tttuuu888/work-issue-71-2, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 85f2f7a 184/195: Fix for prompt line duplicated issue in another way. #71, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 61cb32e 192/195: Fix swiper-avy and ivy-posframe are having trouble #80, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe ad83ce5 189/195: Merge pull request #79 from xeijin/patch-1, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 4474956 194/195: let ivy-posframe-swiper-avy work when do not use ivy-posframe function,
Feng Shu <=
- [elpa] externals/ivy-posframe 556c9a9 161/195: Check (display-graphic-p) dynamically in advices, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 46b4089 081/195: Merge pull request #33 from conao3/issue/remove-top-level-setup-executing, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe f5da408 157/195: remove ivy-display-function, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe c9a7331 143/195: handle ivy-display-function, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 45dc8ee 137/195: Remove ivy-posframe-demo, ivy-posframe-mode can do same job, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 9872f35 135/195: Merge pull request #43 from conao3/ivy-posframe-mode, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 7e33255 134/195: not use macro, write all form, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 2a97933 155/195: Fix for `Error in post-command-hook ...`, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 7be71b6 126/195: fix align, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 3433b00 077/195: Merge pull request #29 from CeleritasCelery/recursive-fix, Feng Shu, 2020/10/03