Coloring/indenting a script within script in Emacs
Asked Answered
L

2

6

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?

Luteous answered 24/9, 2010 at 17:19 Comment(0)
F
1

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!

Farseeing answered 24/9, 2010 at 17:38 Comment(0)
C
1

I use mmm-mode for Mason files (mixing HTML and Perl); maybe it can be of use in your case as well?

Crossquestion answered 24/9, 2010 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.