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

highlight bug? #19

Closed
jagrg opened this Issue Mar 17, 2015 · 26 comments

Comments

Projects
None yet
6 participants
@jagrg

jagrg commented Mar 17, 2015

Swiper erased all highlights in the *Package* buffer immediately after pressing M-x swiper. The same happened in the *EMMS playlist* buffer. Any idea?

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Mar 17, 2015

Owner

Swiper calls font-lock-ensure (or font-lock-fontify-buffer for older Emacs) to have the
selection candidates highlighted. It should be OK to call these functions for any buffer that has
font-lock-mode on.

I think it's a problem of the corresponding mode if it bugs out after a call to font-lock-ensure.
I could add some workarounds though. What are the values of major-mode for the problematic buffers?

Owner

abo-abo commented Mar 17, 2015

Swiper calls font-lock-ensure (or font-lock-fontify-buffer for older Emacs) to have the
selection candidates highlighted. It should be OK to call these functions for any buffer that has
font-lock-mode on.

I think it's a problem of the corresponding mode if it bugs out after a call to font-lock-ensure.
I could add some workarounds though. What are the values of major-mode for the problematic buffers?

abo-abo added a commit that referenced this issue Mar 17, 2015

Work around magit highlighting problem
* swiper.el (swiper-font-lock-ensure): Update.

Re #19
@jagrg

This comment has been minimized.

Show comment
Hide comment
@jagrg

jagrg Mar 17, 2015

I wasn't aware that this was the expected behavior. Would it be possible to revert the buffer to normal once the selection has been made?

jagrg commented Mar 17, 2015

I wasn't aware that this was the expected behavior. Would it be possible to revert the buffer to normal once the selection has been made?

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Mar 17, 2015

Owner

Would it be possible to revert the buffer to normal once the selection has been made?

It's possible not to call font-lock-ensure for problematic major-modes.
I've already added all modes derived from magit-mode to this list.
I just need a list of major-modes which are problematic for you.

Just use M-: (eval-expression) to see what the value of major-mode is.

Owner

abo-abo commented Mar 17, 2015

Would it be possible to revert the buffer to normal once the selection has been made?

It's possible not to call font-lock-ensure for problematic major-modes.
I've already added all modes derived from magit-mode to this list.
I just need a list of major-modes which are problematic for you.

Just use M-: (eval-expression) to see what the value of major-mode is.

@jagrg

This comment has been minimized.

Show comment
Hide comment
@jagrg

jagrg Mar 18, 2015

One is package-menu-mode and the other is emms-playlist-mode.

jagrg commented Mar 18, 2015

One is package-menu-mode and the other is emms-playlist-mode.

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Mar 18, 2015

Owner

See if the last commit solves your issue.

Owner

abo-abo commented Mar 18, 2015

See if the last commit solves your issue.

@jagrg

This comment has been minimized.

Show comment
Hide comment
@jagrg

jagrg Mar 18, 2015

It didn't solve. I replaced the swiper.el file with the most recent one and restarted emacs. Is there something else I need to do?

jagrg commented Mar 18, 2015

It didn't solve. I replaced the swiper.el file with the most recent one and restarted emacs. Is there something else I need to do?

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Mar 18, 2015

Owner

What's your Emacs version? Maybe you could also add a screenshot of the erased highlights in the
package menu.

Owner

abo-abo commented Mar 18, 2015

What's your Emacs version? Maybe you could also add a screenshot of the erased highlights in the
package menu.

@jagrg

This comment has been minimized.

Show comment
Hide comment
@jagrg

jagrg Mar 18, 2015

Updating via melpa fixed the problem. I'll be replacing Isearch with swiper and see how it goes. Thanks for this!

jagrg commented Mar 18, 2015

Updating via melpa fixed the problem. I'll be replacing Isearch with swiper and see how it goes. Thanks for this!

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Mar 18, 2015

Owner

You're welcome. If the same problem comes up for another mode, just reopen this issue.

Owner

abo-abo commented Mar 18, 2015

You're welcome. If the same problem comes up for another mode, just reopen this issue.

@abo-abo abo-abo closed this Mar 18, 2015

@jagrg

This comment has been minimized.

Show comment
Hide comment
@jagrg

jagrg Apr 9, 2015

I think org-agenda-mode also needs to be fixed.

jagrg commented Apr 9, 2015

I think org-agenda-mode also needs to be fixed.

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Apr 9, 2015

Owner

Thanks!

Owner

abo-abo commented Apr 9, 2015

Thanks!

@jagrg

This comment has been minimized.

Show comment
Hide comment
@jagrg

jagrg Sep 29, 2015

Could you also add mu4e-view-mode and mu4e-headers-mode?

jagrg commented Sep 29, 2015

Could you also add mu4e-view-mode and mu4e-headers-mode?

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Sep 29, 2015

Owner

Thanks.

Owner

abo-abo commented Sep 29, 2015

Thanks.

@daimrod

This comment has been minimized.

Show comment
Hide comment
@daimrod

daimrod Oct 22, 2015

w3m-mode and elfeed-show-mode also have problem with font-lock-fontified, could you add them?

Also, given the large number of mode impacted, wouldn't it make sense not to use font-lock-ensure? Why does swipe need it and isearch doesn't? What problem does it fix? If it's more often a problem than not, wouldn't it be easier to set when font-lock-ensure should be ran instead of when not ran it?

daimrod commented Oct 22, 2015

w3m-mode and elfeed-show-mode also have problem with font-lock-fontified, could you add them?

Also, given the large number of mode impacted, wouldn't it make sense not to use font-lock-ensure? Why does swipe need it and isearch doesn't? What problem does it fix? If it's more often a problem than not, wouldn't it be easier to set when font-lock-ensure should be ran instead of when not ran it?

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Oct 23, 2015

Owner

@daimrod The issue is that for all modes where font-lock-ensure does something weird, it's the fault of that mode: they use font-lock without properly defining the syntax. So the buffer may be fontified only once and can't be refreshed.

I think it's good to keep a list of these faulty modes - it may be easier to fix them in the future. For now, I'll just add w3m-mode and elfeed-show-mode to the list.

Owner

abo-abo commented Oct 23, 2015

@daimrod The issue is that for all modes where font-lock-ensure does something weird, it's the fault of that mode: they use font-lock without properly defining the syntax. So the buffer may be fontified only once and can't be refreshed.

I think it's good to keep a list of these faulty modes - it may be easier to fix them in the future. For now, I'll just add w3m-mode and elfeed-show-mode to the list.

@daimrod

This comment has been minimized.

Show comment
Hide comment
@daimrod

daimrod Oct 23, 2015

daimrod commented Oct 23, 2015

@momomo5717

This comment has been minimized.

Show comment
Hide comment
@momomo5717

momomo5717 Oct 31, 2015

Contributor

When font-lock-fontify-buffer was called at emms-stream-mode, this issue occurred.

I'm unfamiliar with font-lock and text-property,
but it seems all 'face of text-property was set to nil
after running font-lock-fontify-buffer-function bound to font-lock-default-fontify-buffer as a local variable,
and (font-lock-unfontify-region (point-min) (point-max)) caused this issue.

I searched for information about font-lock-fontify-buffer-function,
and found the setting example:

(set-default 'font-lock-fontify-buffer-function 'jit-lock-refontify)

It works fine. But I'm not sure it is correct setting.

Thank you.

Contributor

momomo5717 commented Oct 31, 2015

When font-lock-fontify-buffer was called at emms-stream-mode, this issue occurred.

I'm unfamiliar with font-lock and text-property,
but it seems all 'face of text-property was set to nil
after running font-lock-fontify-buffer-function bound to font-lock-default-fontify-buffer as a local variable,
and (font-lock-unfontify-region (point-min) (point-max)) caused this issue.

I searched for information about font-lock-fontify-buffer-function,
and found the setting example:

(set-default 'font-lock-fontify-buffer-function 'jit-lock-refontify)

It works fine. But I'm not sure it is correct setting.

Thank you.

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Oct 31, 2015

Owner

@momomo5717 Thanks, I excluded emms-stream-mode from the fontify list.

Owner

abo-abo commented Oct 31, 2015

@momomo5717 Thanks, I excluded emms-stream-mode from the fontify list.

@momomo5717

This comment has been minimized.

Show comment
Hide comment
@momomo5717

momomo5717 Oct 31, 2015

Contributor

Thank you for adding it!

Contributor

momomo5717 commented Oct 31, 2015

Thank you for adding it!

@josuah

This comment has been minimized.

Show comment
Hide comment
@josuah

josuah Nov 12, 2015

It seems that I found some more:

  • occur-mode, for which g restore the highlight (but also update the content of the buffer);
  • occur-edit-mode
  • bongo-mode

I'm on 24.5.1. Thank you.

josuah commented Nov 12, 2015

It seems that I found some more:

  • occur-mode, for which g restore the highlight (but also update the content of the buffer);
  • occur-edit-mode
  • bongo-mode

I'm on 24.5.1. Thank you.

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Nov 12, 2015

Owner

@sshbio Thanks, updated.

Owner

abo-abo commented Nov 12, 2015

@sshbio Thanks, updated.

@josuah

This comment has been minimized.

Show comment
Hide comment
@josuah

josuah Nov 12, 2015

josuah commented Nov 12, 2015

@josuah

This comment has been minimized.

Show comment
Hide comment
@josuah

josuah Dec 5, 2015

I found one more: vc-dir-mode.

We are building a list that may be useful for other package writers as well.

Again, thank you for improving swiper.

josuah commented Dec 5, 2015

I found one more: vc-dir-mode.

We are building a list that may be useful for other package writers as well.

Again, thank you for improving swiper.

@josuah

This comment has been minimized.

Show comment
Hide comment
@josuah

josuah Dec 29, 2015

bongo-playlist-mode and bongo-playlist-mode buffers also loose their pretty colors.

Thank you for your previous additions. Hopefully I will get a copyright assignment, and will be able to submit pull requests.

josuah commented Dec 29, 2015

bongo-playlist-mode and bongo-playlist-mode buffers also loose their pretty colors.

Thank you for your previous additions. Hopefully I will get a copyright assignment, and will be able to submit pull requests.

@josuah

This comment has been minimized.

Show comment
Hide comment
@josuah

josuah Jan 13, 2016

This list may become pretty long! sauron-mode also seems to be one of them.

josuah commented Jan 13, 2016

This list may become pretty long! sauron-mode also seems to be one of them.

@fuxialexander

This comment has been minimized.

Show comment
Hide comment
@fuxialexander

fuxialexander Aug 3, 2017

Would you please add notmuch-tree-mode and notmuch-search-mode to the list?

fuxialexander commented Aug 3, 2017

Would you please add notmuch-tree-mode and notmuch-search-mode to the list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment