Coloring / indenting a script inside a script in Emacs

I often have shell scripts that call other scripting languages, for example:


#!/bin/bash
cat somefile|awk '
BEGIN
{
  #This line is not auto-indented and is colored as a string constant.
  ...
}
{
  #Same with this line.
  ...
}'

echo "More Bash code here."
...

Is there a way to get Emacs to recognize an awk string as an awk program instead of a string constant?

+5
source share
2 answers

You will need to make your own extensions for existing emacs lisp files. Here is a useful tutorial on learning emacs lisp:
http://www.gnu.org/software/emacs/emacs-lisp-intro/

And here is an example .el file that colors html:
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

Once you're done, post it online so others can take advantage!

+1

mmm-mode Mason ( HTML Perl); , ?

+1

All Articles