Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct highlighting for multiple regexps #1587

Closed

Conversation

@raxod502
Copy link
Contributor

commented May 23, 2018

Fixes #654.

This was a really simple fix. (Only the let* forms and the dolist at the beginning were touched.) So maybe I am missing something?

It may also be necessary to adapt ivy--subexps to handle a list of integers, so that each regexp in the list may have a different number of subexpressions. That could be doable in a separate commit, depending on how important it is.

@raxod502 raxod502 changed the title swiper.el: highlight multiple regexps correctly Correct highlighting for multiple regexps May 23, 2018

ivy.el Outdated
(cl-remove-if
(lambda (regexp-cons)
(null (cdr regexp-cons)))
ivy--old-re))

This comment has been minimized.

Copy link
@basil-conto

basil-conto May 27, 2018

Collaborator

Why not

(cl-mapcan (lambda (cell)
             (and (cdr cell)
                  (list (car cell))))
           ivy--old-re)

or, at the very least,

(mapcar #'car (cl-remove-if-not #'cdr ivy--old-re))

(Guaranteed 100% untested, mind you.)

swiper.el Outdated
(cl-remove-if
(lambda (regexp-cons)
(null (cdr regexp-cons)))
regexp-or-regexps))

This comment has been minimized.

Copy link
@basil-conto

basil-conto May 27, 2018

Collaborator

Ditto.

@raxod502

This comment has been minimized.

Copy link
Contributor Author

commented May 27, 2018

Fixed, thanks.

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2018

Does this relate to #1550 and #1551 at all?

@raxod502

This comment has been minimized.

Copy link
Contributor Author

commented May 31, 2018

I only looked at them briefly, but I think this pull request solves both of those issues. Namely, all subparts of the search query are highlighted in the minibuffer, without having to update ivy-highlight-functions-alist, and match groups are also highlighted both in the buffer and minibuffer.

I used both functionalities in prescient.el:

image

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2018

I only looked at them briefly

As did I, hence the lazy question. :)

but I think this pull request solves both of those issues.

Happy days! Even if this PR doesn't iron out their every kink, you can probably still mention them in the commit message.

Highlight multiple regexps correctly
Fixes #654.
Fixes #1550.
Supersedes #1551.

@raxod502 raxod502 force-pushed the raxod502:feat/swiper-multiple-regexps branch from c827477 to b4fac8b May 31, 2018

@raxod502

This comment has been minimized.

Copy link
Contributor Author

commented May 31, 2018

OK, done :)

@abo-abo abo-abo closed this in 7ec2380 Jun 13, 2018

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jun 13, 2018

Thanks.

@raxod502 raxod502 deleted the raxod502:feat/swiper-multiple-regexps branch Jun 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.