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

Font lock problem of ivy--regex-ignore-order #654

Closed
Yevgnen opened this issue Sep 7, 2016 · 2 comments
Closed

Font lock problem of ivy--regex-ignore-order #654

Yevgnen opened this issue Sep 7, 2016 · 2 comments

Comments

@Yevgnen
Copy link
Contributor

@Yevgnen Yevgnen commented Sep 7, 2016

Hi,

It seem that the font lock works unexpectedly when using ivy--regex-ignore-order.

screen shot 2016-09-07 at 08 10 44

I guess file and expand should be highlighted ?

Minimum config for reproducing can be

(require 'package)

(setq package-archives '(("marmalade" . "http://marmalade-repo.org/packages/")
                         ("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")
                         ("org" . "http://orgmode.org/elpa/")))

(package-initialize)

(unless (and (file-exists-p (expand-file-name "elpa/archives/marmalade" user-emacs-directory))
             (file-exists-p (expand-file-name "elpa/archives/gnu" user-emacs-directory))
             (file-exists-p (expand-file-name "elpa/archives/melpa" user-emacs-directory))
             (file-exists-p (expand-file-name "elpa/archives/org" user-emacs-directory)))
  (package-refresh-contents))

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(setq use-package-verbose t
      use-package-enable-imenu-support t)
(require 'use-package)

(use-package swiper
  :ensure t
  :bind (("C-s" . swiper))
  :init (setq ivy-height 15
              ivy-count-format "(%d/%d) "
              ivy-use-virtual-buffers t
              ivy-initial-inputs-alist nil
              ivy-re-builders-alist '((t . ivy--regex-ignore-order))
              swiper-include-line-number-in-search t))

Thanks !

@jyp
Copy link
Contributor

@jyp jyp commented Sep 22, 2016

I've done some diagnosis on this one.
A special formatting function is active when ivy--regex-ignore-order is active. This formatting function is activated in ivy--format-minibuffer-line under the condition (cond ((eq ivy--regex-function 'ivy--regex-ignore-order).

This condition works typically when ivy callers do not specify a re-builder. Unfortunately, swiper unconditionally overwrites the re-builder with its own function, swiper--re-builder, so the test fails, and we get the default formatting function.

I suppose that the appropriate solution would be to support custom formatting functions, and have swiper provide the corresponding implementation.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Sep 23, 2016

@jyp Patches welcome. I don't use iyv--regex-ignore-order, so it's not a priority for me to make it look nice.

jyp added a commit to jyp/swiper that referenced this issue Dec 14, 2016
@jyp jyp mentioned this issue Dec 14, 2016
abo-abo added a commit that referenced this issue Dec 15, 2016
raxod502 added a commit to raxod502/swiper that referenced this issue May 23, 2018
raxod502 added a commit to raxod502/swiper that referenced this issue May 31, 2018
@abo-abo abo-abo closed this in 7ec2380 Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants