code_formatting_standards
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
code_formatting_standards [2010/03/16 15:00] – more tab exceptions, reorg dbw2 | code_formatting_standards [2022/02/10 13:34] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 35: | Line 35: | ||
set expandtab | set expandtab | ||
set backspace=indent, | set backspace=indent, | ||
- | autocmd BufEnter ? | + | autocmd BufEnter ?akefile*,*txt,*out,*csv, |
- | autocmd BufEnter | + | |
- | autocmd BufEnter | + | |
- | autocmd BufEnter | + | |
</ | </ | ||
In addition, the following VIM options have been recommended by a prominent Evergreen developer but are not actually format related :-) :< | In addition, the following VIM options have been recommended by a prominent Evergreen developer but are not actually format related :-) :< | ||
Line 55: | Line 52: | ||
let loaded_matchparen = 1 | let loaded_matchparen = 1 | ||
</ | </ | ||
+ | |||
+ | ==== GNU Emacs ==== | ||
+ | |||
+ | Add the following lines to your .emacs file and your code will meet the above standards for Perl. | ||
+ | |||
+ | < | ||
+ | ; Use cperl-mode by default | ||
+ | (defalias ' | ||
+ | |||
+ | ; cperl-mode doesn' | ||
+ | ; style in a defun. | ||
+ | (defun evergreen-perl-style () | ||
+ | "Set cperl-mode for Evergreen coding guidelines." | ||
+ | (setq cperl-indent-level | ||
+ | cperl-brace-offset 0 | ||
+ | cperl-continued-brace-offset 0 | ||
+ | cperl-label-offset -4 | ||
+ | cperl-continued-statement-offset 4 | ||
+ | cperl-close-paren-offset -4 | ||
+ | cperl-indent-parens-as-block t | ||
+ | cperl-tab-always-indent t | ||
+ | cperl-merge-trailing-else t | ||
+ | cperl-left-aligned-indent-comments t | ||
+ | indent-tabs-mode nil)) | ||
+ | | ||
+ | ; cperl-mode hook | ||
+ | (add-hook ' | ||
+ | (lambda () | ||
+ | (evergreen-perl-style))) | ||
+ | </ | ||
+ | |||
+ | The above will use these style guidelines on all of your Perl sources. More advanced users might want to configure other styles for different projects and check buffer-file-name to switch styles on a per-buffer basis. You might also want to look into setting many of the cperl-electric-* variables or cperl-hairy. They add a lot of neat features for automatic code completion in Perl. | ||
==== perltidy ==== | ==== perltidy ==== | ||
- | The following options are recommended | + | The following options are recommended |
* -b : Backup and modify in place | * -b : Backup and modify in place | ||
* -ce : Enable the " | * -ce : Enable the " | ||
Example: < | Example: < |
code_formatting_standards.1268766017.txt.gz · Last modified: 2022/02/10 13:33 (external edit)