Thursday, August 21, 2014

Looking for emacs mixed mode editing for functions

I've been looking for a way to edit mixed mode files in emacs, so I can edit a plperl function, and have the create statement part (and everything except the body) use standard SQL mode and the body use CPerl mode or whatever mode some magic marker tells it to use. I've taken a bit of a look at mmm-mode, but haven't been able to get it to work, and don't have more time to spend on it. If someone has a good recipe for this please let me know.


  1. I wish for the same for vim. I also kinda wish I could get vim to understand dollar quoting, though the nice thing about it not understanding that is I can get syntax highlighting in function defenitions. Then again, sounds like that's what you're looking for...

  2. Try this: . I've been using it for a while, it works OK, but it has some robustness issues. When you're in a function body, press C-c ' to open a separate buffer with the function body, then press C-c C-c when done.

    I've also thought about doing a mixed-mode buffer, but I think that would be more complex and potentially less useful. With the separate buffer, you can take advatange of flymake integration, for example.

    If people find this useful, I can try finishing it.