From: chromatic <[EMAIL PROTECTED]>
   Date: Wed, 2 Jul 2008 22:48:02 -0700

   These are the files in a pristine repository with 'ex: set ro:' in
   them; can you (or another Emacs user) edit them to add the
   appropriate tag for Emacs?

The attached patch does this, but raises a question.  In the process, I
discovered that most of these source files became read-only, because
Emacs was looking at the wrong "Local variables:" list!  Here is what
Emacs expects:

        The start of the local variables list must be no more than 3000
        characters from the end of the file, and must be in the last
        page if the file is divided into pages.  Otherwise, Emacs will
        not notice it is there . . .  [1]

It turns out that Emacs uses the *first* such list in the last page or
3000 chars [2], which is often the one in the heredoc.  To correct that,
I had to add formfeeds to the end of some files.  Is this obscure enough
in the Perl world to need a comment before the formfeed, so that
somebody doesn't delete it?

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

[1]  See the "File Variables" node in the Emacs manual,
     M-: (Info-goto-node "(emacs)File Variables")

[2]  I should probably report this as a bug in Emacs, but that won't
     help until Emacs 23.1 has been out for a while.

* tools/build/jit2c.pl:
* tools/build/pbcversion_h.pl:
* tools/build/vtable_h.pl:
* tools/build/vtable_extend.pl:
* tools/build/c2str.pl:
* tools/build/parrot_config_c.pl:
* lib/Parrot/Ops2pm/Utils.pm:
* lib/Parrot/Manifest.pm:
* lib/Parrot/Ops2c/Utils.pm:
* MANIFEST:
* MANIFEST.generated:
* config/gen/call_list.pm:
* config/gen/platform.pm:
   + Add "buffer-read-only: t" to Emacs "Local variables:" sections in
     generated files.  In most cases, this also means adding a formfeed
     character before the source file's "Local variables:" section so
     that Emacs can tell which one to use.

Diffs between last version checked in and current workfile(s):

Index: tools/build/jit2c.pl
===================================================================
--- tools/build/jit2c.pl        (revision 29037)
+++ tools/build/jit2c.pl        (working copy)
@@ -507,6 +507,7 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
@@ -520,6 +521,7 @@
     return ( ( $ptr eq '&' ? '&' : '' ) . sprintf( $argmaps{ 
$type_to_arg{$type} }, $index ) );
 }
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: tools/build/pbcversion_h.pl
===================================================================
--- tools/build/pbcversion_h.pl (revision 29037)
+++ tools/build/pbcversion_h.pl (working copy)
@@ -55,11 +55,13 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
 EOF
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: tools/build/vtable_h.pl
===================================================================
--- tools/build/vtable_h.pl     (revision 29037)
+++ tools/build/vtable_h.pl     (working copy)
@@ -67,11 +67,13 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
 EOC
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: tools/build/vtable_extend.pl
===================================================================
--- tools/build/vtable_extend.pl        (revision 29037)
+++ tools/build/vtable_extend.pl        (working copy)
@@ -48,6 +48,7 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
@@ -157,6 +158,7 @@
 
 close $OUT or die $!;
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: tools/build/c2str.pl
===================================================================
--- tools/build/c2str.pl        (revision 29037)
+++ tools/build/c2str.pl        (working copy)
@@ -227,6 +227,7 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
@@ -236,6 +237,7 @@
     return;
 }
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: tools/build/parrot_config_c.pl
===================================================================
--- tools/build/parrot_config_c.pl      (revision 29037)
+++ tools/build/parrot_config_c.pl      (working copy)
@@ -105,11 +105,13 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
 EOC
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: lib/Parrot/Ops2pm/Utils.pm
===================================================================
--- lib/Parrot/Ops2pm/Utils.pm  (revision 29037)
+++ lib/Parrot/Ops2pm/Utils.pm  (working copy)
@@ -613,6 +613,7 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
@@ -682,6 +683,7 @@
 
 1;
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: lib/Parrot/Manifest.pm
===================================================================
--- lib/Parrot/Manifest.pm      (revision 29037)
+++ lib/Parrot/Manifest.pm      (working copy)
@@ -82,6 +82,13 @@
     }
 }
 
+my $text_file_coda = <<'CODA';
+# Local variables:
+#   mode: text
+#   buffer-read-only: t
+# End:
+CODA
+
 sub print_manifest {
     my $self               = shift;
     my $manifest_lines_ref = shift;
@@ -100,6 +107,7 @@
     for my $k ( sort keys %{$manifest_lines_ref} ) {
         $print_str .= sprintf "%- 59s %s\n", ( $k, $manifest_lines_ref->{$k} );
     }
+    $print_str .= $text_file_coda;
     open my $MANIFEST, '>', $self->{file}
         or croak "Unable to open $self->{file} for writing";
     print $MANIFEST $print_str;
Index: lib/Parrot/Ops2c/Utils.pm
===================================================================
--- lib/Parrot/Ops2c/Utils.pm   (revision 29037)
+++ lib/Parrot/Ops2c/Utils.pm   (working copy)
@@ -543,6 +543,7 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */
Index: MANIFEST
===================================================================
--- MANIFEST    (revision 29037)
+++ MANIFEST    (working copy)
@@ -3940,3 +3940,7 @@
 tools/util/smokeserv-server.pl                              []
 tools/util/templates.json                                   []
 tools/util/update_copyright.pl                              []
+# Local variables:
+#   mode: text
+#   buffer-read-only: t
+# End:
Index: MANIFEST.generated
===================================================================
--- MANIFEST.generated  (revision 29037)
+++ MANIFEST.generated  (working copy)
@@ -306,3 +306,7 @@
 src/string_private_cstring.h                      [main]include
 tools/build/dynpmc.pl                             [devel]
 tools/install/smoke.pl                            [main]
+# Local variables:
+#   mode: text
+#   buffer-read-only: t
+# End:
Index: config/gen/call_list.pm
===================================================================
--- config/gen/call_list.pm     (revision 29037)
+++ config/gen/call_list.pm     (working copy)
@@ -1,5 +1,5 @@
 # Copyright (C) 2008, The Perl Foundation.
-# $Id: $
+# $Id$
 
 =head1 NAME
 
@@ -38,6 +38,13 @@
     }
 }
 
+my $text_file_coda = <<'CODA';
+# Local variables:
+#   mode: text
+#   buffer-read-only: t
+# End:
+CODA
+
 sub runstep {
     my ( $self, $conf ) = @_;
 
@@ -57,6 +64,7 @@
 
         print {$combined} $fragment;
     }
+    print {$combined} $text_file_coda;
 
     $conf->append_configure_log($combined_file);
 
@@ -65,6 +73,7 @@
 
 1;
 
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4
Index: config/gen/platform.pm
===================================================================
--- config/gen/platform.pm      (revision 29037)
+++ config/gen/platform.pm      (working copy)
@@ -57,6 +57,7 @@
 /*
  * Local variables:
  *   c-file-style: "parrot"
+ *   buffer-read-only: t
  * End:
  * vim: expandtab shiftwidth=4:
  */

End of diffs.

Reply via email to