Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Perl mode for GNU Emacs

by Anonymous Monk
on Mar 05, 2000 at 05:54 UTC ( #4886=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Pumpkinhead here, Trying to figure out what to do to customize my GNU Emacs (20.3-15) under RH6.0 to use Perl (5.005). Going here doesn't really help. I want to learn Emacs and Perl at the same time. There seems to be a perl mode and cperl mode. What should I use? Do I already have it? Thanks, P

Replies are listed 'Best First'.
Re: Perl mode for GNU Emacs
by Anonymous Monk on Mar 08, 2000 at 11:32 UTC
    Learning emacs and Perl at the same time: surely a big endeavour! But with great rewards after a while. My best wishes. To answer a few points in your posting: - If your emacs kit is complete, you should already have perl mode and cperl mode. Your problem is to invoke it. See below. - The use of these modes is to get colors (comments in pink, double-quoted strings in purple, etc), to get a proper indentation each time you type a brace, or a semi-colon, and other nifty features. - .emacs is the personal configuration file, like .profile or .vimrc for other purposes. It should be in your home directory. - The lines you should add to this file: their use is to invoke *automatically* perl mode or cperl mode, each time you load ("visit" as they say in emacs doc) a perl script. But you do not really need it at first. Instead, you can type ESC x perl-mode RET or ESC x cperl-mode RET each time you "visit" a perl script. Later, when you are no longer a newbie, you will update your .emacs script, with the perl mode you like better (perl or cperl). - When you know enough emacs commands, including split window commands, you should try this: - "visit" a perl script - open "Programming Perl" (the Camel book) page 517 - type ESC x perldb - enjoy! I have tried the Perl debugger while in bash, and I have disliked it. I have tried it while under emacs, and it is great! - If you can read French, I can help you learn emacs, by sending you a list of useful commands. This is a 9K HTML file. Write me to (person to person mail, no mailing list, no Perl monk web page)
      These last two replies were great. This site has been quite a discovery. And, yes, I can speak French although my writing is pretty choppy. Donc je vais vous envoyez un email. Merci. Tete de Citrouille
Re: Perl mode for GNU Emacs
by ua (Initiate) on Mar 06, 2000 at 15:08 UTC
    The cperl-mode that comes with XEmacs is extremely old. If I recall, version 1.40 is in the distribution. You can find the latest version, currently 4.26, at Ilya Zakharevich's ftp site:

      But beware that if you install the new cperl it may not work unless you also install or already have installed other packages and macros. like x-display-pixel-height, for instance.

      without the ancillary macros the new cperl won't work.

Re: Perl mode for GNU Emacs
by Anonymous Monk on Mar 06, 2000 at 13:07 UTC
    Here's a snip from my ~/.emacs (global-font-lock-mode 1) (add-to-list 'auto-mode-alist '("\\.\\(pPLlm\\|xs\\|perl\\)$" . cperl-mode)) .. that should do it.
      Oops .. that's (2) lines:
      (global-font-lock-mode 1)
      (add-to-list 'auto-mode-alist '("\\.\\(pPLlm\\|xs\\|perl\\)$" . cperl-mode))
        hi, are u saying that I actually write this in a file called ".emacs" and something is supposed to happen? (global-font-lock-mode 1) (add-to-list 'auto-mode-alist '("\\.\\(pPLlm\\|xs\\|perl\\)$" . cperl-mode)) Can u elaborate any? P
RE: Perl mode for GNU Emacs
by Anonymous Monk on Mar 08, 2000 at 06:30 UTC
    If you have installed emacs off of the Redhat 6.x CD, You already have perl mode for emacs installed. I use it all the time and it works great. What you want to do is turn on 'Syntax Highlighting', which in emacs is called 'font-lock-mode'. To turn on font lock mode globally select the Options from the help menu and check 'Global Font Lock' this will enable syntax highlighting for all emacs recognized programming languages (including perl).
Re: Perl mode for GNU Emacs
by Anonymous Monk on Mar 06, 2000 at 00:11 UTC
    At the risk of starting a religious war, which really isn't my intention here, I would recommend trying out XEmacs ( It comes with cperl-mode as the default Perl mode by default, and has several other, IMO, improvements over GNU Emacs. Aside from that, cperl-mode is good, better than perl-mode in my experience, and according to cperl-mode.el is a part GNU Emacs, so you should already have it. Have you tried activating cperl-mode (M-x cperl-mode) in a buffer? -- Mishka

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://4886]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2022-01-18 01:56 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (52 votes). Check out past polls.