Conflict with electric-pair-mode #1188
Closed
Comments
It can be reproduced with just the following patch seems to avoid the crash: diff --git a/swiper.el b/swiper.el
index e7dfee2..26efa35 100644
--- a/swiper.el
+++ b/swiper.el
@@ -659,15 +659,18 @@ WND, when specified is the window."
(while (<= (cl-incf j) ivy--subexps)
(let ((bm (match-beginning j))
(em (match-end j)))
- (while (and (< j ivy--subexps)
- (= em (match-beginning (+ j 1))))
- (setq em (match-end (cl-incf j))))
- (swiper--add-overlay
- bm em
- (nth (1+ (mod (+ i 2) (1- (length swiper-faces))))
- swiper-faces)
- wnd i)
- (cl-incf i))))))))))
+ (when (and (integerp em)
+ (integerp bm))
+ (while (and (< j ivy--subexps)
+ (integerp (match-beginning (+ j 1)))
+ (= em (match-beginning (+ j 1))))
+ (setq em (match-end (cl-incf j))))
+ (swiper--add-overlay
+ bm em
+ (nth (1+ (mod (+ i 2) (1- (length swiper-faces))))
+ swiper-faces)
+ wnd i)
+ (cl-incf i)))))))))))
(defun swiper--add-overlay (beg end face wnd priority)
"Add overlay bound by BEG and END to `swiper--overlays'.
|
@mookid Please PR. |
mookid
added a commit
to mookid/swiper
that referenced
this issue
Sep 8, 2017
This triggered an error on (swiper "[^ ]") (see abo-abo#1188).
@raxod502 Please test. |
@abo-abo Works for me now. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Method to reproduce:
swiper
, revisionbf0e4388d7c30914a3cc62c0472b5b8207d9b2e6
.M-x electric-pair-mode
.M-x swiper
.[^
(left bracket, caret, space). Due toelectric-pair-mode
this results in[^ ]
, where point is before the right bracket.Error in post-command-hook (ivy--exhibit): (wrong-type-argument number-or-marker-p nil)
Using
M-x toggle-debug-on-error
does not produce a stack trace.System information
installed from
brew cask
.The text was updated successfully, but these errors were encountered: