list-hooks.pl 811 B

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