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

xenops does not "work" until buffer is (re)fontified #71

Open
dankessler opened this issue Apr 3, 2024 · 0 comments
Open

xenops does not "work" until buffer is (re)fontified #71

dankessler opened this issue Apr 3, 2024 · 0 comments

Comments

@dankessler
Copy link

dankessler commented Apr 3, 2024

Steps to reproduce:

First, create a simple test.tex file with content

\documentclass{article}
\begin{document}
Here is math: $x^2$.
\end{document}
  1. In a fresh emacs session, open test.tex
  2. Turn on xenops-mode: M-x xenops-mode
  3. Put cursor inside the math: $x^2$
  4. Move cursor outside the math
  5. Nothing happens (expected: math would render)

However, the following works as expected

  1. In a fresh emacs session, open test.tex
  2. Turn on xenops-mode: M-x xenops-mode RET
  3. M-x font-lock-update RET
  4. Put cursor inside the math: $x^2$
  5. Move cursor outside the math
  6. Yay! The math renders!

Step 3 can be replaced with many alternatives that indirectly will cause the buffer to be refontified, e.g., saving, editing, etc.

As far as I can tell, this is because during activation, xenops-mode adds some font-lock keywords that should trigger rendering on cursor moving using cursor-sensor-mode, but it doesn't actually cause these new font-lock keywords to be "applied."

I imagine this can be fixed by explicitly calling font-lock-fontify-buffer when mode is activated.

This is easy enough to work around, but it caused a lot of confusion for me when I followed the tutorial, which at one point suggests that the user open a file, turn on xenops-mode, move the cursor in and out of math, and see a render result.

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

1 participant