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

Emacs 25 and objc-mode inside auctex #68

Open
oguibe opened this issue Feb 20, 2017 · 2 comments
Open

Emacs 25 and objc-mode inside auctex #68

oguibe opened this issue Feb 20, 2017 · 2 comments

Comments

@oguibe
Copy link

oguibe commented Feb 20, 2017

Hello

First I am totally incompetent about lisp. In fact I am trying to adapt asy-mode (from the
Asymptote distribution) with mmm-mode. asy-mode contains a lasy-mode which gives
with two-mode.el the possibility to have highlight asymptote code into a LaTeX file.
Since it seems that two-mode does not work with emacs 24 or emacs 25, or at least that the two proposed modifications produce error with auctex+asy-mode, I tried mmm-mode.

Asy-mode is based on objc-mode. If I add asy-mode to the variable mmm-c-derived-modes
it seems to be ok with Emacs 24. It is a good news.

But with Emacs 25 I remarked a difference behavior which is not related to asy-mode.
For example the following LaTeX code which contains objc code is not highlighted
(the above part) due to the only to for (...) part (another objc code is ok)

\documentclass[12pt]{article}
\usepackage{lmodern}
\begin{document}
\begin{code}
  for(int i=0; i< 10 ; i++)
  {
    }
\end{code}
\end{document}

Here my configuration (in fact I am using spacemacs)

(setq mmm-global-mode 'maybe)
(setq mmm-submode-decoration-level 2)
(mmm-add-classes
  '((mmm-objc-latex
    :submode objc-mode
    :front "^\\\\begin{code}\n"
    :back "^\\\\end{code}"
  )))
(mmm-add-mode-ext-class 'latex-mode nil 'mmm-objc-latex)

Is related to cc-mode, mmm-mode or auctex ?

Regards
O.G.

@dgutov
Copy link
Owner

dgutov commented Feb 20, 2017

A good way to investigate such problems is to evaluate

(font-lock-fontify-region (point-min) (point-max))

It gives a backtrace, and the first time I tried it it led to a variable we needed to save and set in CC Mode subregions (see the linked commit). But that led to a second backtrace which I don't have enough energy to decipher.

Either way, CC Mode has very poor compatibility with mmm-mode, among other things, because of how it treats narrowing. Try using js-mode instead of objc-mode. The former is not very strict about syntax, and it should give you decent experience.

@oguibe
Copy link
Author

oguibe commented Feb 24, 2017

Many thanks for you kind answer.
Since I am not able to understand the message of (font-lock-fontify-region (point-min) (point-max)) I will follow your advice : js-mode.

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