9

The Emacs cperl-mode seems to get confused less than perl-mode, but the Skittles effect makes the thing unusable for me. Does anyone have or know of an example of a .emacs block that causes cperl-mode to use the colorization from perl-mode, ideally in a form readable enough that I can go back and turn back on the default colors one element at a time until I reach something I'm comfortable with?

In particular there is a hideously shade of light green used for some builtins that I find quite unreadable, and I prefer my variables to not have the leading $ and $$ and such tinted red along with the variable name. Most of the rest are merely distracting.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Zed
  • 3,457
  • 3
  • 20
  • 21

4 Answers4

8

Press M-x customize-group RET cperl-faces RET and change coloring to your liking.

Ilya Martynov
  • 396
  • 1
  • 8
  • This doesn't quite cover everything, like allowing me to prevent colorization of leading glyphs, but it looks like this is as close as I'm going to get, thanks. – Zed Nov 14 '08 at 20:31
2

With colour themes, the problem is limited to arrays and hashes - and it turns out that that's because cperl-mode defines those faces as being bold-weight, which colour themes don't appear to affect (Solarized doesn't).

In Emacs 23.3 on Mac OS, the following restored the colours to how the colour theme defined them:

(custom-set-faces
 '(cperl-array-face ((t (:weight normal))))
 '(cperl-hash-face ((t (:weight normal))))
)
Sam Kington
  • 1,202
  • 11
  • 14
1

You can also use the 'real' perl-mode coloring by overwriting font-lock settings with those of perl-mode.

(require 'perl-mode)

(add-hook 'cperl-mode-hook
          (lambda ()
            (setq font-lock-defaults
                  '((perl-font-lock-keywords perl-font-lock-keywords-1 perl-font-lock-keywords-2)
                    nil nil ((?\_ . "w")) nil
                    (font-lock-syntactic-face-function . perl-font-lock-syntactic-face-function)))
            (font-lock-refresh-defaults)))
zk_phi
  • 195
  • 5
0

You can change the color theme if you don't like the particular default colors.

kixx
  • 3,245
  • 22
  • 19
  • This doesn't help. ColorTheme appears to change all the colors *except* the ones used by cperl-mode, and it doesn't change the colorization of leading glyph, and it doesn't appear to be particularly configurable. But thanks for the idea. – Zed Nov 07 '08 at 16:54
  • The problem with cperl-mode appears to be purely limited to arrays and hashes - at least when I tried with Solarize (http://ethanschoonover.com/solarized), that was the only area where colours weren't overridden. – Sam Kington May 05 '11 at 19:41