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
Asked
Active
Viewed 330 times
3
-
1Try the solutions for [multiple modes](https://emacswiki.org/emacs/MultipleModes). – Gilles 'SO- stop being evil' Sep 07 '16 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 Ash Sep 08 '16 at 16:03
1 Answers
-2
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?

Xah Lee
- 1,756
- 12
- 11
-
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 Ash Jul 09 '16 at 20:50
-
@GaryAsh See https://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 Lee Jul 10 '16 at 01:52