Background: I've been working with a program that is about half Bash and half perl. I thought I'd give mmm-mode a try since it sounded like just the mode for me. I don't know lisp well enough to be useful.
I used "elpa" to install mmm-mode. It didn't install the
documentation anyplace my emacs could find it. There was no
mmm.info
file anywhere on the system (though there was a texinfo file). So I downloaded the
mmm-mode-master.zip
and installed it. So far, so good.
I added the following to my ~/.emacs
file.
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'perl-mode nil 'perl-shell-script)
(mmm-add-group 'perl-shell-script
'((perl-shell-script-here
:submode shell-script-mode
:face mmm-default-submode-face
:front "#begin-shell-script-mode\n"
:back "#end-shell-script-mode\n"
:save-matches 1)))
I based this on this post: Multiple major modes in one buffer (e.g., python-mode & LaTeX-mode) I think the :save-matches
is unused in my case, but it shouldn't be an error.
The problem: The <tab>
key doesn't work within the "shell-script"
portion of the file.
I "believe" that mmm-mode is working correctly. The highlighting
changes. The mode line changes. It seems to contain the correct
information: (Perl[Shell-script] MMM)
.
I checked the key binding (C-h k): TAB (translated from <tab>) runs the command indent-for-tab-command
.
But all it really does is insert a '\t'.
I can't tell if the trouble is mmm-mode
, shell-script-mode
, or
perl-mode
(I'm not using cperl-mode
at this point).
Any ideas?
-E
Sample file:
#!/usr/bin/perl
while(<>) {
print;
}
printf(<<"BASHSHELL",
#begin-shell-script-mode
while getopts "ca" options; do
case "\${options}" in
c )
echo "Cleaning up."
cleanup
exit 0
;;
a )
echo "Setting auto clean up for %s."
AUTOCLEANUP=1
;;
* )
echo "Usage: \$0 [-c]"
exit 1
;;
esac
done
#end-shell-script-mode
BASHSHELL
"FOO");