]> git.eshelyaron.com Git - emacs.git/commitdiff
* admin/check-doc-strings: Reduce false positives.
authorStefan Kangas <stefankangas@gmail.com>
Sat, 22 Feb 2025 03:21:10 +0000 (04:21 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Feb 2025 08:10:01 +0000 (09:10 +0100)
(cherry picked from commit 79ab873b9b679ec0aedb03ce246035d8e5d4b09c)

admin/check-doc-strings

index b119b50885b7aac94dcf607ff789c117f95e9acd..ced8989b2d24093b57d10bfe65bb5e331d678701 100755 (executable)
@@ -256,7 +256,7 @@ while (my $file = <FIND>) {
       ## $maxargs
       \s*(\S+)\s*,
       ## $interactive
-      \s*((?:0|\"(?:(?:[^\\\"]|\\.)*)\"))\s*,
+      \s*((?:0|NULL|\"(?:(?:[^\\\"]|\\.)*)\"))\s*,
       ## $docstring
       \s*doc:\s*\/\*\s*(.*?)\s*\*\/
       # attributes -- skip
@@ -297,7 +297,7 @@ while (my $file = <FIND>) {
   $contents =~ s/(?:\s|;);.*//mog;
   my @matches =
     ($contents =~
-     /\((def(?:un|subst|macro))\s+(\S+)\s+\(([^()]*)\)\s+\"((?:[^\\\"]|\\.)+)\"(.*?)\)/sgo);
+     /\((def(?:un|subst|macro)|cl-defun)\s+(\S+)\s+\(([^()]*)\)\s+\"((?:[^\\\"]|\\.)+)\"(.*?)\)/sgo);
   while (@matches) {
     my ($defform, $function, $parms, $docstring, $code_fragment) = splice (@matches, 0, 5);
 
@@ -320,17 +320,21 @@ while (my $file = <FIND>) {
   my $contents = FileContents $file;
   $contents =~ s/(?:\s|;);.*//mog;
 
-  my @matches = ($contents =~ /^\((?:defalias|fset|define-function)\s+\'([A-Za-z0-9_-]+)\s+\'([A-Za-z0-9_-]+)/mog);
+  my @matches = ($contents =~ /^\((?:defalias|fset|define-function)\s+\'([A-Za-z0-9_<>=-]+)\s+[#]?\'([A-Za-z0-9_-]+)/mog);
   while (@matches) {
     my ($alias, $aliasee) = splice (@matches, 0, 2);
     print "alias $alias aliasee $aliasee\n";
     if (exists $code_funtype{$aliasee}) { $code_funtype{$alias} = $code_funtype{$aliasee}; }
+    else {$code_funtype{$alias} = 1;}
     if (exists $code_arglist{$aliasee}) { $code_arglist{$alias} = $code_arglist{$aliasee}; }
   }
 }
 
+# FIXME: Consider cl-defgeneric, minor and major modes.
+
 foreach my $fun (sort keys %texi_funtype) {
   if (not exists $code_funtype{$fun}) {
+    next if $fun eq 'foo';
     print "nuke-this-doc: $fun $texi_funtype{$fun}\n";
   }
 }