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

asy-mode.el: "concat: Symbol’s value as variable is void: LaTeX-verbatim-regexp" on M-x lasy-mode #418

Open
agreselin opened this issue Jan 15, 2024 · 5 comments

Comments

@agreselin
Copy link

Hello, I'm trying to set up asy-mode following Editing-modes and LaTeX-usage. On doing M-x lasy-mode in latexusage.tex I get concat: Symbol’s value as variable is void: LaTeX-verbatim-regexp and lasy-mode doesn't turn on.

@agreselin
Copy link
Author

A bit of context: I'm on Emacs 30.0.50 and I've downloaded two-mode-mode from https://www.dedasys.com/freesoftware/files/two-mode-mode.el. I've managed not to get any warnings or errors with

(setq LaTeX-verbatim-regexp nil)
(defalias 'turn-on-font-lock-if-enabled 'ignore)

The second line is for

Error running timer ‘two-mode-mode-update-mode’: (void-function turn-on-font-lock-if-enabled)

which I got after fixing the error about LaTeX-verbatim-regexp. (Maybe turn-on-font-lock-if-desired instead of ignore would be a better choice?)

Still, I don't know if the mode works as intended. Asymptote code is fontified only if lasy-mode is called from within an asy environment, but then the LaTeX code is unfontified. (featurep 'two-mode-mode) returns t, anyway.

@johncbowman
Copy link
Member

Make sure you are using the latest version (from about 3 years ago) of https://raw.githubusercontent.com/vectorgraphics/asymptote/HEAD/base/asy-mode.el

The symbol LaTeX-verbatim-regexp is defined on line 1066.

@agreselin
Copy link
Author

Hey John, hi! Thanks for Asymptote, I've seen what it can do and I'm very excited to learn it.

I have the version you linked. Now I don't get the void variable error for LaTeX-verbatim-regexp, there must have been something wrong with my config when I opened this issue, sorry. I still get Error running timer ‘two-mode-mode-update-mode’: (void-function turn-on-font-lock-if-enabled). Also, in lasy-mode Asymptote code is syntax-highlighted correctly but LaTeX code is not, I don't know if this is expected.

I get five Warning: ‘defadvice’ is an obsolete macro (as of 30.1); use ‘advice-add’ or ‘define-advice’. I can translate the defadvice's to the constructs in nadvice.el and send a pull request if you're interested.

@johncbowman
Copy link
Member

I verified that if you open up latexusage.tex with emacs 28.3, execute lasy-mode and scroll down, syntax highlighting of the LaTeX code is suddenly disabled. Perhaps it has always been this way. If you execute lasy-mode again from within an asy block, you get the (void-function turn-on-font-lock-if-enabled) error. Executing lasy-mode repeatedly outside an asy block will give an args out of range error or the LaTeX-verbatim-regexp error. So apparently these issues have nothing to do with changes in Emacs 30. If you manage to fix these issues, a pull request would be welcome. For now, just execute lasy-mode once and all should be well.

@agreselin
Copy link
Author

Fixing the issue is outside of my immediate possibilities. What I can do is translate the old defadvice's which raise the warning.

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

2 participants