I'd like to mix org-mode and c-mode in Emacs. Everything inside a comment should be org-mode, the rests should be default major-mode c-mode:
/*
Org-mode here
** Section 1
text
** Section 2
text
Org-mode should end here
*/
func1()
{
}
I tried using nXhtml multi-major-mode, I guess there are other modes that support multimodes too. My problem now is that if I type TAB on "section 2" then all below "Section 2" will be folded and made invisible. But I would like to contain the region that org-mode folds/unfolds to the comment section. The TAB should only fold/unfold till the "*/".
I wonder how I can achieve this?
I found a solution: http://lists.gnu.org/archive/html/emacs-orgmode/2011-01/msg00036.html lists a patch for org-mode:
This patch has to be applied by hand, its not that difficult. It adds the marker
*#
that will break the indention. @bzg pointed out theM-x orgstruct-mode RET
mode, credits to him. Now I can write in c.mode with orgstruct-mode in the background (no multi-major-mode needed any more):And I will have org-mode in comments, The Section 1 and Section 2 will fold until the
*#
marker.