Giter Site home page Giter Site logo

highlight bug? about swiper HOT 26 CLOSED

abo-abo avatar abo-abo commented on August 17, 2024
highlight bug?

from swiper.

Comments (26)

abo-abo avatar abo-abo commented on August 17, 2024

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?

from swiper.

jagrg avatar jagrg commented on August 17, 2024

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?

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

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.

from swiper.

jagrg avatar jagrg commented on August 17, 2024

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

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

See if the last commit solves your issue.

from swiper.

jagrg avatar jagrg commented on August 17, 2024

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?

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

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

from swiper.

jagrg avatar jagrg commented on August 17, 2024

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

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

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

from swiper.

jagrg avatar jagrg commented on August 17, 2024

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

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

Thanks!

from swiper.

jagrg avatar jagrg commented on August 17, 2024

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

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

Thanks.

from swiper.

daimrod avatar daimrod commented on August 17, 2024

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?

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

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

from swiper.

daimrod avatar daimrod commented on August 17, 2024

from swiper.

momomo5717 avatar momomo5717 commented on August 17, 2024

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.

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

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

from swiper.

momomo5717 avatar momomo5717 commented on August 17, 2024

Thank you for adding it!

from swiper.

 avatar commented on August 17, 2024

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.

from swiper.

abo-abo avatar abo-abo commented on August 17, 2024

@sshbio Thanks, updated.

from swiper.

 avatar commented on August 17, 2024

from swiper.

 avatar commented on August 17, 2024

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.

from swiper.

 avatar commented on August 17, 2024

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.

from swiper.

 avatar commented on August 17, 2024

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

from swiper.

fuxialexander avatar fuxialexander commented on August 17, 2024

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

from swiper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.