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

highlight bug? #19

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

highlight bug? #19

jagrg opened this issue Mar 17, 2015 · 26 comments

Comments

@jagrg
Copy link

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
Copy link
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
* swiper.el (swiper-font-lock-ensure): Update.

Re #19
@jagrg
Copy link
Author

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
Copy link
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
Copy link
Author

jagrg commented Mar 18, 2015

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

@abo-abo
Copy link
Owner

abo-abo commented Mar 18, 2015

See if the last commit solves your issue.

@jagrg
Copy link
Author

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
Copy link
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
Copy link
Author

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
Copy link
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 as completed Mar 18, 2015
@jagrg
Copy link
Author

jagrg commented Apr 9, 2015

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

@abo-abo
Copy link
Owner

abo-abo commented Apr 9, 2015

Thanks!

@jagrg
Copy link
Author

jagrg commented Sep 29, 2015

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

abo-abo added a commit that referenced this issue Sep 29, 2015
@abo-abo
Copy link
Owner

abo-abo commented Sep 29, 2015

Thanks.

@daimrod
Copy link

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
Copy link
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
Copy link

daimrod commented Oct 23, 2015 via email

@momomo5717
Copy link
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.

@abo-abo
Copy link
Owner

abo-abo commented Oct 31, 2015

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

@momomo5717
Copy link
Contributor

Thank you for adding it!

@ghost
Copy link

ghost 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
Copy link
Owner

abo-abo commented Nov 12, 2015

@sshbio Thanks, updated.

@ghost
Copy link

ghost commented Nov 12, 2015 via email

@ghost
Copy link

ghost 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.

@ghost
Copy link

ghost 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.

@ghost
Copy link

ghost commented Jan 13, 2016

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

@fuxialexander
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants