Question

I'm trying to write a new emacs mode for a new template c-like language, which I have to use for some academic research.

I want the code to be colored and indented like in c-mode, with the following exceptions:

  • The '%' is not used as an operator, but as the first character in some specific keywords (like: "%p", "%action", etc.)
  • The code lines do not end with a semicolon.

Is it possible to create a derived-mode (from c-mode) and set it to ignore the original purposes of '%' and ';'? Is it possible to make the feature of "automatic-indentation after pressing RET" work without ';'?

Are there similar modes for similar languages (with '{}' brackets, but without semicolons) that I could try to patch?

Should I try to write a major mode from scratch?

I thought about patching the R-mode from http://ess.r-project.org/, but this mode does not support comments of the form "/* comment */".

The most important feature that I'm looking for is the brackets-indentation, i.e. indenting code inside a '{}' block after pressing RET (and without the extra-indentation after lines that do not end with ';'). Partial solutions will help too.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top