bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55386: 29.0.50; check-declare-directory doesn't work on Windows


From: Eli Zaretskii
Subject: bug#55386: 29.0.50; check-declare-directory doesn't work on Windows
Date: Sat, 14 May 2022 12:09:56 +0300

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: yasu@utahime.org,  55386@debbugs.gnu.org
> Date: Fri, 13 May 2022 17:46:50 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I'm not sure.  How much time does it take for the find/grep command to
> > finish working on our lisp/ directory on your system?
> 
> Let's see...
> 
> (benchmark-run (check-declare-directory "~/src/emacs/trunk/lisp/"))
> 
> 11 seconds.  Perhaps a pure-Lisp solution wouldn't be that much slower,
> anyway?
> 
> (Hm...  it finds over a 100 in-tree declarations that it says are
> malformed/wrong...  Perhaps somebody should have a look at that.)

Yes, please.

> > And this command is not really time-critical anyway.
> 
> That's true.
> 
> > In any case, we could use the Lisp path only on Windows, since having
> > a slower command is better than having a broken command.
> 
> If we have a Lisp solution, I think I'd prefer to use that on all
> platforms.  Easier to debug when there only one code path, for one.

How about the below?  It's 3% to 9% slower than the find/grep version
(because it examines more files, I think), but much simpler (IMNSHO),
and works on any platform without any caveats.

diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el
index b3c9651..83187ac 100644
--- a/lisp/emacs-lisp/check-declare.el
+++ b/lisp/emacs-lisp/check-declare.el
@@ -319,11 +319,7 @@ check-declare-directory
   (setq root (directory-file-name (file-relative-name root)))
   (or (file-directory-p root)
       (error "Directory `%s' not found" root))
-  (let ((files (process-lines-ignore-status
-                find-program root
-                "-name" "*.el"
-                "-exec" grep-program
-                "-l" "^[ \t]*(declare-function" "{}" "+")))
+  (let ((files (directory-files-recursively root "\\.el\\'")))
     (when files
       (apply #'check-declare-files files))))
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]