[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 5d52d4b 352/395: Call isearch-filter-predicat
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 5d52d4b 352/395: Call isearch-filter-predicate instead of isearch-range-invisible |
Date: |
Thu, 25 Feb 2021 08:32:37 -0500 (EST) |
branch: externals/ivy-hydra
commit 5d52d4bd2ccd11faa78c3c0de8bbd5f2b9058140
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Call isearch-filter-predicate instead of isearch-range-invisible
* swiper.el (swiper--update-input-ivy):
(swiper-multi-action-2):
(swiper-all-action):
(swiper-isearch-action): Call the function specified by option
isearch-filter-predicate instead of directly calling the function
isearch-range-invisible
When `isearch' itself is being used, then a major-mode can change the
value of variable `isearch-filter-predicate' to control how `isearch'
determines whether a certain range of text is visible already and how
to make it visible otherwise.
While `swiper' relies on `isearch' to deal with invisible text, it
bypasses this variable causing major-modes to lose control over how
this is done.
The default value of this variable is `isearch-filter-visible', which
in turn calls `isearch-range-invisible'. However it does not do so
unconditionally:
(defun isearch-filter-visible (beg end)
"Return non-nil if text between BEG and END is deemed visible by
Isearch.
This function is intended to be used as `isearch-filter-predicate'.
It returns non-nil if the text between BEG and END is visible to
Isearch, at least partially, as determined by `isearch-range-invisible'.
If `search-invisible' is t, which allows Isearch matches inside
invisible text, this function will always return non-nil, regardless
of what `isearch-range-invisible' says."
(or (eq search-invisible t)
(not (isearch-range-invisible beg end))))
The reason why `swiper' instead calls `isearch-range-invisible'
directly probably is that we concluded that we should make sure that
text is always made visible. That is the wrong conclusion for a few
reasons, not least that it achieves the opposite in some cases.
If `search-invisible' is non-nil, then that means that "search" should
not skip over invisible text. If it is `open' then that means that
"search" itself should take care of making that text visible.
A value of t means that "search" should forgo making the text visible.
Enabling `reveal-mode' or `global-reveal-mode' sets `search-invisible'
to t, because these modes themselves take care of making text visible
if necessary.
Respecting `isearch-filter-predicate' is less likely to break
anything, then it is to ignore the wishes of major-modes, which
provide their own implementation because they know that the default
implementation won't work for them.
---
swiper.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/swiper.el b/swiper.el
index d5e32b8..7075285 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1,6 +1,6 @@
;;; swiper.el --- Isearch with an overview. Oh, man! -*- lexical-binding: t -*-
-;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2020 Free Software Foundation, Inc.
;; Author: Oleh Krehel <ohwoeowho@gmail.com>
;; URL: https://github.com/abo-abo/swiper
@@ -964,8 +964,9 @@ the face, window and priority of the overlay."
(setq swiper--current-line num))
(when (re-search-forward re (line-end-position) t)
(setq swiper--current-match-start (match-beginning 0))))
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
+ (funcall isearch-filter-predicate
+ (line-beginning-position)
+ (line-end-position))
(swiper--maybe-recenter)))
(swiper--add-overlays
re
@@ -1214,8 +1215,9 @@ otherwise continue prompting for buffers."
(re-search-forward
(ivy--regex ivy-text)
(line-end-position) t)
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
+ (funcall isearch-filter-predicate
+ (line-beginning-position)
+ (line-end-position))
(unless (eq ivy-exit 'done)
(swiper--cleanup)
(swiper--add-overlays (ivy--regex ivy-text))))))))
@@ -1338,8 +1340,9 @@ See `ivy-format-functions-alist' for further information."
(with-ivy-window
(switch-to-buffer buffer-name)
(goto-char (get-text-property 0 'point x))
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
+ (funcall isearch-filter-predicate
+ (line-beginning-position)
+ (line-end-position))
(unless (eq ivy-exit 'done)
(swiper--cleanup)
(swiper--add-overlays (ivy--regex ivy-text))))))))
@@ -1483,7 +1486,7 @@ that we search only for one character."
(eq last-command 'ivy-previous-line-or-history)))
(looking-back ivy-regex (line-beginning-position)))
(goto-char (match-beginning 0)))
- (isearch-range-invisible (point) (1+ (point)))
+ (funcall isearch-filter-predicate (point) (1+ (point)))
(swiper--maybe-recenter)
(if (eq ivy-exit 'done)
(progn
- [elpa] externals/ivy-hydra 39ede5f 324/395: targets/plain.el: Require ivy-avy, (continued)
- [elpa] externals/ivy-hydra 39ede5f 324/395: targets/plain.el: Require ivy-avy, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d951004 336/395: doc: Conflate installation description, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3a2c5b2 300/395: counsel.el: Mark obsolete the functions that can be replaced by complete-symbol, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3ecf828 344/395: ivy.el (ivy-switch-buffer): Don't lose the current index, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 01d9f55 343/395: ivy.el: Fix minibuffer highlighter selction, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d4fd99f 316/395: Respect original default choice when deduplicating extra actions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 62815d9 311/395: Makefile: Compile ivy-avy.el, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7c0796f 333/395: ivy.el (ivy-shrink-after-dispatching): Resize only when in minibuffer, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a007ba6 334/395: Fix for counsel-grep-like-occur, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra eb53165 313/395: ivy.el (ivy--compute-extra-actions): Dedup on key, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5d52d4b 352/395: Call isearch-filter-predicate instead of isearch-range-invisible,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 7f88b67 345/395: counsel.el (counsel-highlight-with-face): New action for counsel-faces, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d52ee0a 301/395: ivy.el (ivy-completion-in-region): Restrict new behavior to elisp code, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3b1737c 361/395: * counsel.el (counsel-linux-app): Improve prompt., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1723799 368/395: Fix M-o 'Wrong type argument: characterp' error, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra fc2801f 367/395: `counsel-find-file': open file in foreground, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ae9b121 366/395: Avoid face blending errors when loading swiper.el, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 796220b 357/395: ivy.el (ivy-alt-done): Extend to programmed completion, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 911a360 365/395: Consistently use modern face spec syntax, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 74f411d 355/395: Remove Emacs 28 workaround in counsel-descbinds, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 778d8bf 363/395: * counsel.el (counsel-org-files): Simplify regexp., Basil L. Contovounesios, 2021/02/25