Appendix C. Text Editors That Understand Mason
In order to write Mason components, you don’t need anything fancy. You can do just fine with any old ramshackle text editor — even (horrors!) a word processor that can save as plain text will do.
However, an editor that helps you manage the details of the document you’re creating can be a nice mini-luxury. Several different editors can easily be trained to understand the structure of Mason components, with varying degrees of assistance (or interference, depending on how much help you’re looking for). In most cases, this is due to the work of Mason developers who created syntax definitions and offered them to the general public. If you find shortcomings, the polite thing to do is to drop a note to the developer, offering a fix if possible.
Emacs
Both authors of this book are enthusiastic users of Emacs and its wonderful cperl-mode for editing plain Perl code, courtesy of Ilya Zakharevich. However, while one can just turn cperl-mode on for an entire Mason component and get some basic syntax highlighting, brace matching, and indentation, the result is necessarily clumsy, since large parts of the component aren’t Perl code.
Michael Abraham Shulman, a Mason contributor from way back, developed a much nicer solution. His Multiple-Major-Mode Mode (mmm-mode) is a way to combine cperl-mode and html-mode (or sgml-mode, if you prefer), each in the correct region of the component. Of course, like a true hubristic programmer, Michael addressed the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access