开发者

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 开发者_Python百科just a string constant?


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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜