Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coloring/indenting a script within script in Emacs

I often have shell scripts that call other scripting languages, like so:


#!/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 make Emacs recognize the awk string as an awk program instead of just a string constant?

like image 393
User1 Avatar asked Sep 24 '10 17:09

User1


1 Answers

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

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

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

like image 198
Jason R. Mick Avatar answered Sep 30 '22 08:09

Jason R. Mick