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

C-mode indentation doesn't work in mmm-mode with the Noweb class #55

Open
nrnrnr opened this issue Jul 29, 2015 · 2 comments
Open

C-mode indentation doesn't work in mmm-mode with the Noweb class #55

nrnrnr opened this issue Jul 29, 2015 · 2 comments

Comments

@nrnrnr
Copy link

nrnrnr commented Jul 29, 2015

Using emacs 24, I'm trying to use mmm-mode with noweb and C code.
But the indentation is not working correctly.

Here's an example cut from a very large file:

thousands of lines here
<<johnny>>=
void f(int a) {
           return g(a);
     }          
@ 

Placing the cursor on return and calling c-indent-line doesn't accomplish anything.

I've tracked the problem as far as the c-in-literal function, which claims that this position occurs inside a string. Function c-in-literal calls widen, which is unfortunate, and my Emacs Lisp skills are not good enough to find a fluid let that would prevent that widen from going beyond the region in mmm-mode that contains the code in question.

Here's another example from a complete file:

% -*- mmm-noweb-code-mode: c-mode; -*-
just one line here

<<johnny>>=
int f(int a) {
              return z;
    }      
@ 

In this example, the failure mode on calling c-indent-line is different: c-in-literal returns the right thing, but a different error occurs: c-after-conditional: Wrong type argument: stringp, nil.

There's nothing obviously wrong with mmm-mode here; when indentation is asked for, it is correctly calling c-indent-line. But it is not working for its intended purpose. I would welcome some help figuring out how either mmm-mode or c-mode could be modified so they could work together.

dgutov added a commit that referenced this issue Jul 30, 2015
@dgutov
Copy link
Owner

dgutov commented Jul 30, 2015

I've got rid of some Wrong type argument errors (hopefully all?), but the indentation is still going crazy, and CC Engine is a rabbit hole too deep to get into. Maybe you should just set mmm-noweb-code-mode to js-mode, its syntax is similar, and it's less crazy.

mmm-noweb.el still contains the traces of trying to make different code believe everything beyond the current subregion is whitespace (see mmm-space-other-regions and nearby), but I'm not sure what the exact goals were, and how far it progressed.

@nrnrnr
Copy link
Author

nrnrnr commented Jul 31, 2015

I agree CC Engine is terrifying. 11,000 lines of elisp! I will have a go at 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