Jeffrey Ryan Thalhammer > Perl-Critic-More > Perl::Critic::Policy::Editor::RequireEmacsFileVariables

Download:
Perl-Critic-More-1.003.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  2
Open  3
View/Report Bugs
Module Version: 1.003   Source  

NAME ^

Perl::Critic::Policy::Editor::RequireEmacsFileVariables - Per-file editor settings.

AFFILIATION ^

This policy is part of Perl::Critic::More, a bleeding edge supplement to Perl::Critic.

DESCRIPTION ^

Many text editors know how to find magic strings in files that indicate settings that work best for that file. For example, the file can indicate that it expects four-character indentation.

In emacs, this magic string is called "File Variables". There are two syntaxes: -*- ... -*- (single-line) and Local Variables:\n...\nEnd: (multi-line). Both syntaxes allow leading and trailing text on the line.

The single-line syntax must be used on the first line of the file to be recognized, or on the second line if the first line is a shebang. The following examples are explicitly allowed by Perl:

   #!perl -w -*- cperl -*-
   #!perl -w # -*- cperl -*-
   #!perl # -*- cperl -*-

The multi-line syntax must be used "in the last page" (that is, after the last formfeed) at the end of the file. As of Emacs21, the "end of the file" is hard-coded to be the last 3000 bytes of the file (in the hack-local-variables function in files.el). In this syntax, each line must begin and end with the same prefix/suffix pair. That pair is defined by the text before and after the "Local Variables:" string.

SEE ALSO ^

Perl::Critic::Policy::Editor::RequireViModeline

http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html

In Emacs, you can view the "File Variables" info node by typing: Help-key, i, g, (emacs)File Variables (where Help-key is often C-h or F1.)

Alternatively, you can execute the following elisp: (info "(emacs)File Variables")

AUTHOR ^

Chris Dolan <cdolan@cpan.org>

Michael Wolf <MichaelRWolf@att.net>

COPYRIGHT ^

Copyright (c) 2006-2008 Chris Dolan

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.

syntax highlighting: