I have a bash shell script that has a fairly sizable amount of perl code in it. Is there a why to get perl syntax highlighting instead of the normal here doc coloring? Thank you for any help, I'm new to emacs and still getting the hang of elisp and the terminology
-
1Try the solutions for multiple modes.– Gilles 'SO- stop being evil'Commented Sep 7, 2016 at 21:22
-
thanks, mmm-mode seems to work well. I'm having a hard time getting to automatically recognize the perl code. As i said i have perl script in a bash here doc. parse region seems to get it when i do it manually– Gary AshCommented Sep 8, 2016 at 16:03
Add a comment
|
1 Answer
You can just M-x perl-mode
to activate perl mode.
Or, set a easy key to perl-mode. For example,
(global-set-key (kbd "<f8>") 'perl-mode)
Or, you can put add this comment to the first line in the bash file
# -*- mode: perl -*-
then, it'll open with perl mode.
Or, you can put the following at the bottom
# Local Variables:
# eval: (perl-mode 1)
# End:
Does that answer your question?
-
I wanted this in shell highlight #!/usr/bin/env bash for file in $(find $HOME -depth 1 -name ".*"); do echo $file done sudo perl <<-'PERL' #&> /dev/null # this in perl highlighting #!/usr/bin/env perl #**************************************************************************************** # libraries used #**************************************************************************************** use strict; use warnings;– Gary AshCommented Jul 9, 2016 at 20:50
-
@GaryAsh See emacswiki.org/emacs/MultipleModes but i don't think they'll be smooth, as emacs is designed for just 1 major mode per buffer.– Xah LeeCommented Jul 10, 2016 at 1:52