Can I use cperl-mode with perl-mode colorization?

寵の児 提交于 2019-12-03 07:42:05

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

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))))
)

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)))

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!