Skip to content

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

Open
@dankessler

Description

@dankessler

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      xenops does not "work" until buffer is (re)fontified · Issue #71 · dandavison/xenops