Merge branch 'maint'
[org-mode.git] / mk / list-hooks.pl
blobffacd7c79ebcc2838a3bdc988b0263c5130468d6
1 #!/usr/bin/perl
2 @files = glob("lisp/org-*.el");
3 unshift @files,"lisp/org.el";
5 print "* Hooks and Function variables\n\n";
7 foreach $file (@files) {
8 ($file1 = $file) =~ s|.*/||;
9 open IN,"<$file" or die "Cannot open file $file\n";
10 while (<IN>) {
11 if (/^\((defvar|defcustom)\s+(org-.*?-(hook|functions?)\b)/) {
12 $deftype = $1;
13 $name = $2;
14 $_=<IN> while (not m/^\s*"/);
15 $doc = $_;
16 while (not m/(?<!\\)"\)?\s*$/) {
17 $_=<IN>;
18 $doc .=$_;
20 $doc =~ s/\A\s*"//;
21 $doc =~ s/"\)?\s*\Z//;
22 print "** =$name=\n";
23 print "Defined in: /$file1/\n";
24 print "#+begin_example\n";
25 @lines = split(/\n/,$doc);
26 @lines = map { $_ = " " . $_ } @lines;
27 $doc = join("\n",@lines);
28 print "$doc\n";
29 print "#+end_example\n";