summaryrefslogtreecommitdiff
path: root/embed.pl
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-11 07:54:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-11 07:54:19 +0000
commit37442d52629699d89ef62d315d35efbc0facec21 (patch)
tree9a628dce9299a88717fc402055910fb432a0b326 /embed.pl
parent24801a4b9a14a56208916a537c4c237993c25186 (diff)
downloadperl-37442d52629699d89ef62d315d35efbc0facec21.tar.gz
Include vim/emacs modelines in generated files to open them
in read-only mode. Make vi modelines compatible with non-vim vi versions. p4raw-id: //depot/perl@24445
Diffstat (limited to 'embed.pl')
-rwxr-xr-xembed.pl15
1 files changed, 11 insertions, 4 deletions
diff --git a/embed.pl b/embed.pl
index 9cdef0782a..fd4a91718f 100755
--- a/embed.pl
+++ b/embed.pl
@@ -24,6 +24,7 @@ sub do_not_edit ($)
$years =~ s/1999,/1999,\n / if length $years > 40;
my $warning = <<EOW;
+ -*- buffer-read-only: t -*-
$file
@@ -79,7 +80,7 @@ sub walk_table (&@) {
$F = $filename;
}
else {
- safer_unlink $filename;
+ safer_unlink $filename if $filename ne '/dev/null';
open F, ">$filename" or die "Can't open $filename: $!";
binmode F;
$F = \*F;
@@ -120,7 +121,7 @@ sub munge_c_files () {
if (@_ > 1) {
$functions->{$_[2]} = \@_ if $_[@_-1] =~ /\.\.\./;
}
- } '/dev/null', '';
+ } '/dev/null', '', '';
local $^I = '.bak';
while (<>) {
# if (/^#\s*include\s+"perl.h"/) {
@@ -250,8 +251,8 @@ sub write_global_sym {
$ret;
}
-walk_table(\&write_protos, "proto.h", undef);
-walk_table(\&write_global_sym, "global.sym", undef);
+walk_table(\&write_protos, "proto.h", undef, "/* ex: set ro: */\n");
+walk_table(\&write_global_sym, "global.sym", undef, "# ex: set ro:\n");
# XXX others that may need adding
# warnhook
@@ -601,6 +602,7 @@ print EM <<'END';
# define Perl_sv_setpvf_mg_nocontext Perl_sv_setpvf_mg
#endif
+/* ex: set ro: */
END
close(EM) or die "Error closing EM: $!";
@@ -710,6 +712,8 @@ for $sym (sort @extvars) {
print EM <<'END';
#endif /* PERL_POLLUTE */
+
+/* ex: set ro: */
END
close(EM) or die "Error closing EM: $!";
@@ -829,6 +833,7 @@ print CAPIH <<'EOT';
#endif /* __perlapi_h__ */
+/* ex: set ro: */
EOT
close CAPIH or die "Error closing CAPIH: $!";
@@ -905,6 +910,8 @@ unsigned char** Perl_Gfold_locale_ptr(pTHX) {
END_EXTERN_C
#endif /* MULTIPLICITY */
+
+/* ex: set ro: */
EOT
close(CAPI) or die "Error closing CAPI: $!";