I recently worked on autoload.el to add support for autoloading
functions defined in modules, as part of work on modularizing the core.
I'll share that work soon. While absorbing generate-file-autoloads-1, I
noticed a few things that either puzzled me or struck me as wrong. Can
somebody check me here?
1) There is a while loop near the end with most of the body commented
out. The comment says, in part, "Emacs -- I still haven't figured
this one out." Given the code that surrounds this while loop, it
appears that the loop is doing nothing but wasting time by going to
the end of a line, and then to the next line, repeatedly until
reaching output-end. How about commenting out the entire loop?
2) The "Generating autoloads for..." message uses trim-name, but the
corresponding "done" message uses file. That means that the messages
look like this:
Generating autoloads for autoload.el...
Generating autoloads for /i-unpacked-xemacs-here/lisp/autoload.el...done
The last message should use trim-name, too.
3) The algorithm for finding the next autoload cookie when funlist is
nil (so that dolist is also nil) looks odd to me. Look for the while
loop that starts just after the "Generating autoloads" message. The
while loop condition is effectively that we have not reached the end
of the buffer. Then we skip forward over whitespace characters. Now
we evaluate the cond. Unless we happen to be right on an autoload
cookie, we do not take the first clause. That means that we skip
over whatever comment or sexp we happen to be looking at and go
around the loop again.
While this works, it means that we are examining the file comment by
comment and sexp by sexp to try to find an autoload cookie, instead
of just searching directly for the next one. Why? I realize that
the speed of this process is completely unimportant, but I would
think that it would make the algorithm clearer (and this algorithm
desperately needs to be clearer!).
I'm willing to make a patch for any and all of these if the consensus is
that one is appropriate.
--
Jerry James
http://www.ittc.ku.edu/~james/