Search code examples
emacspdecperl-mode

Emacs Pretty Symbols in cperl mode: :: must be surrounded my spaces


I'm using Emacs with PDE and cperl-mode. I really want prettify-symbols-mode to work with it. When just using perl-mode this happens:

Mod::thing->new( {c => 'sea'} );

becomes

Mod∷thing→new( {c ⇒ 'sea'} );

however when using cperl same expression becomes

Mod::thing→new( {c ⇒ 'sea'} );

in cperl-mode the :: only becomes when it is separated by spaces on both sides.

I have tried adding to the cperl--pretty-symbols-alist and pretty-symbols-alist. and still only the -> and => work.

I thought it might be how cperl defines characters as symbols or words, but the -> and => work just fine without being surrounded by spaces.


Solution

  • I got it. I went to /usr/share/emacs/26.1/lisp/progmodes and deleted a file called cperl-mode.elc. then I went into an archinve here /usr/share/emacs/26.1/lisp/progmodes/cperl-mode.el.gz. I edited line 1498 of cperl-mode.el to be (modify-syntax-entry ?: "." cperl-mode-syntax-table) instead of (modify-syntax-entry ?: "_" cperl-mode-syntax-table). Then I byte-compiled the file and put it back in /usr/share/emacs/26.1/lisp/progmodes.