Perl::...riables(3pm)
π NAME π (bestie, this is the one)
okay so you're looking at Perl::Critic::Policy::Editor::RequireEmacsFileVariables β and yeah the manual calls it Per-file editor settings β¨ like, it's the policy that cares whether your file is telling your editor how to treat it. no cap.
π AFFILIATION π (where this policy hangs out)
This policy is part of Perl::Critic::More β which is literally described as a bleeding edge supplement to Perl::Critic. it's giving bonus content, deluxe edition, the extended cut π
πΈ DESCRIPTION πΈ (the lore, explained)
Many text editors know how to find magic strings in files that indicate settings that work best for that file π¦ like bestie, the file itself is out here saying "hi, i would like four-character indentation please." iconic behavior.
In emacs, this magic string is called "File Variables" and there are two syntaxes, periodt:
"-*- ... -*-"β the single-line one"Local Variables:\n...\nEnd:"β the multi-line one
and the way that both syntaxes allow leading and trailing text on the line?? yeah. flexible queens π
β¨ the single-line syntax β¨
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. (shebang privileges, iykyk π)
The following examples are explicitly allowed by Perl:
#!perl -w -*- cperl -*-
#!perl -w # -*- cperl -*-
#!perl # -*- cperl -*-
look at them. three little icons. all valid. we love to see it π
π the multi-line syntax π
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). yes bestie, 3000. very specific. very main character of them.
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. so it's a matching set. a coordinated outfit. slay π
π SEE ALSO π (the required reading, bestie)
Perl::Critic::Policy::Editor::RequireViModelineβ the vi-flavored sibling, we stan both- <http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html> β the actual docs, go read them fr fr
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")
one line. does the whole thing. lowkey iconic π
π«Ά AUTHOR π«Ά (the legends themselves)
- Chris Dolan
<cdolan@cpan.org> - Michael Wolf
<MichaelRWolf@att.net>
thank you for your service π«‘π
π COPYRIGHT π (the legal tea, but make it cute)
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. π
okay bestie real talk β that's the whole policy. every option, every example, every byte count, all of it. nothing skipped, nothing invented. you're welcome π
and that's a wrap, gorgeous β¨ this was perl v5.42.0, dated 2025-07-25, and yes we were all reading Perl::...riables(3pm) together the whole time πππ go forth and set your file variables, periodt.
π¦ where this page comes from
- fedora 43: perl-Perl-Critic-More 1.003-33.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms