From 3f20f60f91fe668e73eb5ad82acf5cdb9b0f06df Mon Sep 17 00:00:00 2001 From: Akira Tamamori Date: Sat, 25 May 2019 23:46:36 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9C=80=E8=BF=91=E3=81=AEavy=E6=9C=AC?= =?UTF-8?q?=E5=AE=B6=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=AB=E8=BF=BD=E9=9A=8F?= =?UTF-8?q?=E3=81=97=E3=81=9FPR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- avy-migemo.el | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/avy-migemo.el b/avy-migemo.el index 5c8bc41..4e0c68b 100644 --- a/avy-migemo.el +++ b/avy-migemo.el @@ -561,13 +561,12 @@ BEG / LEN is an integer." (interactive (list (read-char "char: " t) current-prefix-arg)) (avy-with avy-goto-char - (avy--generic-jump + (avy-jump (if (= 13 char) "\n" ;; Adapt for migemo (avy-migemo-regex-quote-concat (string char))) - arg - avy-style))) + :window-flip arg))) ;;;###autoload (defun avy-migemo-goto-char-2 (char1 char2 &optional arg beg end) @@ -576,32 +575,32 @@ BEG / LEN is an integer." (read-char "char 2: " t) current-prefix-arg nil nil)) - (when (eq char1 ? ) + (when (eq char1 ? +) (setq char1 ?\n)) - (when (eq char2 ? ) + (when (eq char2 ? +) (setq char2 ?\n)) (avy-with avy-goto-char-2 - (avy--generic-jump + (avy-jump ;; Adapt for migemo (if (eq char1 ?\n) (concat (string char1) (avy-migemo-regex-quote-concat (string char2))) (avy-migemo-regex-quote-concat (string char1 char2))) - arg - avy-style - beg end))) + :window-flip arg + :beg beg :end end))) ;;;###autoload (defun avy-migemo-goto-char-in-line (char) "The same as `avy-goto-char-in-line' except for the candidates via migemo." (interactive (list (read-char "char: " t))) (avy-with avy-goto-char - (avy--generic-jump + (avy-jump ;; Adapt for migemo (avy-migemo-regex-quote-concat (string char)) - avy-all-windows - avy-style - (line-beginning-position) - (line-end-position)))) + :window-flip avy-all-windows + :beg (line-beginning-position) + :end (line-end-position)))) (defun avy-migemo--read-candidates (&optional re-builder group) "The same as `avy--read-candidates' except for the candidates via migemo. @@ -679,7 +678,7 @@ If GROUP is no-nil, the group will be highlighted. Default value is 0." (not avy-all-windows) avy-all-windows))) (avy-with avy-goto-char-timer - (avy--process + (avy-process ;; Adapt for migemo (avy-migemo--read-candidates) (avy--style-fn avy-style))))) @@ -719,7 +718,7 @@ If GROUP is no-nil, the group will be highlighted. Default value is 0." (concat "\\b" (avy-migemo-regex-concat str)))))) - (avy--generic-jump regex arg avy-style beg end)))) + (avy-jump regex :window-flip arg :beg beg :end end)))) (defcustom avy-migemo-use-isearch-search-fun nil "If non-nil, `avy-migemo-isearch' uses `isearch-search-fun'." @@ -771,7 +770,7 @@ If GROUP is no-nil, the group will be highlighted. Default value is 0." (avy-with avy-isearch (let ((avy-background nil)) ;; Adapt for migemo - (avy--process (if avy-migemo-use-isearch-search-fun + (avy-process (if avy-migemo-use-isearch-search-fun (avy-migemo--isearch-candidates isearch-string) (avy--regex-candidates (avy-migemo-regex-concat isearch-string))) @@ -789,7 +788,7 @@ If GROUP is no-nil, the group will be highlighted. Default value is 0." (not avy-all-windows) avy-all-windows))) (avy-with avy-goto-char-timer - (avy--process + (avy-process ;; Addapt for migemo (avy-migemo--read-candidates (lambda (input) From 053c7523e0053dc25f7942e2b43cde60d1399672 Mon Sep 17 00:00:00 2001 From: Akira Tamamori Date: Sat, 25 May 2019 23:49:17 +0900 Subject: [PATCH 2/5] =?UTF-8?q?counsel=E3=81=AB=E3=81=8A=E3=81=91=E3=82=8B?= =?UTF-8?q?=E9=96=A2=E6=95=B0=E5=90=8D=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=AB?= =?UTF-8?q?=E8=BF=BD=E9=9A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・counsel-more-chars が ivy-more-charsになった --- avy-migemo-e.g.counsel.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avy-migemo-e.g.counsel.el b/avy-migemo-e.g.counsel.el index 3b95b8e..d09ef9b 100644 --- a/avy-migemo-e.g.counsel.el +++ b/avy-migemo-e.g.counsel.el @@ -144,7 +144,7 @@ after `counsel-unquote-regex-parens'." "The same as `counsel-ag-function' except for using migemo." (when (null extra-pt-args) (setq extra-pt-args "")) - (or (counsel-more-chars) + (or (ivy-more-chars) (let ((default-directory (ivy-state-directory ivy-last)) (regex (counsel-unquote-regex-parens-migemo ; Adapt for migemo (setq ivy--old-re @@ -236,7 +236,7 @@ after `counsel-unquote-regex-parens'." (defun counsel-grep-function-migemo (string) "The same as `counsel-grep-function' except for using migemo." - (or (counsel-more-chars) + (or (ivy-more-chars) (let ((regex (counsel-unquote-regex-parens-migemo ; Adapt for migemo (setq ivy--old-re (ivy--regex-migemo string)))) From 7cecac644087d99cf0a98b8b443c8ee6e5d2b342 Mon Sep 17 00:00:00 2001 From: Akira Tamamori Date: Sat, 25 May 2019 23:49:53 +0900 Subject: [PATCH 3/5] swiperno --- avy-migemo-e.g.swiper.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/avy-migemo-e.g.swiper.el b/avy-migemo-e.g.swiper.el index 5761110..b193b2f 100644 --- a/avy-migemo-e.g.swiper.el +++ b/avy-migemo-e.g.swiper.el @@ -38,7 +38,7 @@ If nil, `swiper-min-highlight' will be used." :type '(choice integer (const :tag "Use `swiper-min-highlight'." nil))) -(defun swiper--add-overlays-migemo-visible-regions (beg end) +(defun swiper--make-overlays-migemo-visible-regions (beg end) "Return visible regions between BEG and END." (let ((pt beg) npt @@ -48,10 +48,10 @@ If nil, `swiper-min-highlight' will be used." (unless (invisible-p pt) (push (cons pt npt) regions)) (setq pt npt)) (nreverse regions))) -(byte-compile 'swiper--add-overlays-migemo-visible-regions) +(byte-compile 'swiper--make-overlays-migemo-visible-regions) -(defun swiper--add-overlays-migemo-ignore-order (re-seq &optional beg end wnd) - "Add overlays at lines matched by RE-SEQ from BEG to END on WND. +(defun swiper--make-overlays-migemo-ignore-order (re-seq &optional beg end wnd) + "Make overlays at lines matched by RE-SEQ from BEG to END on WND. RE-SEQ is a list of \(regex . boolean)." (setq wnd (or wnd (ivy-state-window ivy-last))) (cl-macrolet ((lbeg-pos () '(if visual-line-mode @@ -86,24 +86,24 @@ RE-SEQ is a list of \(regex . boolean)." (setq lbeg (max (lbeg-pos) beg)) (setq lend (min (lend-pos) end)))) (cl-loop - for (lbeg . lend) in (swiper--add-overlays-migemo-visible-regions lbeg lend) do + for (lbeg . lend) in (swiper--make-overlays-migemo-visible-regions lbeg lend) do (cl-loop with i-face = 1 for (re . match-p) in re-seq do (goto-char lbeg) (while (and match-p (re-search-forward re lend t)) - (swiper--add-overlay + (swiper--make-overlay (match-beginning 0) (match-end 0) (nth (1+ (mod (+ i-face 2) (1- (length swiper-faces)))) swiper-faces) wnd i-face)) (when match-p (cl-incf i-face))))) (goto-char lend))))))) -(byte-compile 'swiper--add-overlays-migemo-ignore-order) +(byte-compile 'swiper--make-overlays-migemo-ignore-order) -(defun swiper--add-overlays-migemo (re &optional beg end wnd) - "The same as `swiper--add-overlays' except adapting it for migemo's regexp." +(defun swiper--make-overlays-migemo (re &optional beg end wnd) + "The same as `swiper--make-overlays' except adapting it for migemo's regexp." (setq wnd (or wnd (ivy-state-window ivy-last))) (let ((ov (if visual-line-mode (make-overlay @@ -130,11 +130,11 @@ RE-SEQ is a list of \(regex . boolean)." (>= (length ivy-text) swiper-migemo-min-highlight) (>= (length re) swiper-min-highlight)) (if (eq ivy--regex-function 'ivy--regex-ignore-order) - (swiper--add-overlays-migemo-ignore-order + (swiper--make-overlays-migemo-ignore-order (ivy--regex-ignore-order ivy-text) beg end wnd) (save-excursion (cl-loop - for (beg . end) in (swiper--add-overlays-migemo-visible-regions beg end) do + for (beg . end) in (swiper--make-overlays-migemo-visible-regions beg end) do (goto-char beg) ;; RE can become an invalid regexp (while (and (ignore-errors (re-search-forward re end t)) @@ -150,7 +150,7 @@ RE-SEQ is a list of \(regex . boolean)." (let ((mb (match-beginning 0)) (me (match-end 0))) (unless (> (- me mb) 2017) - (swiper--add-overlay mb me + (swiper--make-overlay mb me (if (zerop ivy--subexps) (cadr swiper-faces) (car swiper-faces)) @@ -170,14 +170,14 @@ RE-SEQ is a list of \(regex . boolean)." (setq c-mbeg (or c-mbeg mbeg)) (unless (and (match-beginning (1+ i)) (= mend (match-beginning (1+ i)))) - (swiper--add-overlay + (swiper--make-overlay mbeg (setq l-mend mend) (nth (1+ (mod (+ i-face 2) (1- (length swiper-faces)))) swiper-faces) wnd i-face) (setq c-mbeg nil) (cl-incf i-face))))))))))) -(byte-compile 'swiper--add-overlays-migemo) +(byte-compile 'swiper--make-overlays-migemo) (defvar search-default-mode) (defun swiper--re-builder-migemo-around (fn &rest args) @@ -187,7 +187,7 @@ RE-SEQ is a list of \(regex . boolean)." (byte-compile 'swiper--re-builder-migemo-around) ;; For using with avy-migemo-mode -(avy-migemo-add-names 'swiper--add-overlays-migemo +(avy-migemo-add-names 'swiper--make-overlays-migemo '(swiper--re-builder :around swiper--re-builder-migemo-around)) From 9bcf3b5edefb69b96e13b76a0080a0e27f4d5480 Mon Sep 17 00:00:00 2001 From: Akira Tamamori Date: Sat, 25 May 2019 23:51:37 +0900 Subject: [PATCH 4/5] =?UTF-8?q?swiper=E3=81=AE=E6=9C=80=E8=BF=91=E3=81=AE?= =?UTF-8?q?=E9=96=A2=E6=95=B0=E5=90=8D=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=AB?= =?UTF-8?q?=E8=BF=BD=E9=9A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・swiper--add-overlays が swiper--make-overlays になった 以上に伴って関数名を変更した: ・swiper--add-overlays-migemo-visible-regions が swiper--make-overlays-migemo From 88738a6657dd3e25ee3ef814512c402505da8669 Mon Sep 17 00:00:00 2001 From: Akira Tamamori Date: Wed, 17 Jul 2019 11:43:21 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9C=80=E8=BF=91=E3=81=AEcounsel=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=AB=E8=BF=BD=E9=9A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit changed from counsel-unquote-regex-parens to counsel--elisp-to-pcre. --- avy-migemo-e.g.counsel.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avy-migemo-e.g.counsel.el b/avy-migemo-e.g.counsel.el index d09ef9b..8253ddd 100644 --- a/avy-migemo-e.g.counsel.el +++ b/avy-migemo-e.g.counsel.el @@ -99,7 +99,7 @@ This function will be used for `counsel-unquote-regex-parens-migemo'." "Replace the backslash of \\\\| with empty string in STR. after `counsel-unquote-regex-parens'." (replace-regexp-in-string "\\(\\\\\\)|" "" - (counsel-unquote-regex-parens str) nil nil 1)) + (counsel--elisp-to-pcre str) nil nil 1)) (byte-compile 'counsel-unquote-regex-parens-migemo-default) (defun counsel-unquote-regex-parens-migemo (str)