Let's say I have Emacs Lisp library ~/emacs/my-lib.el
with contents:
;;;###autoload
(defun my-func()
"hello"
(interactive)
(message "Hello"))
(provide 'my-lib)
I would now like to produce a file ~/emacs/my-lib-autoload.el
with autoload statements for ~/emacs/my-lib.el
.
The documentation for update-file-autoloads
says ( "C-h f update-file-autoloads"
)
(update-file-autoloads FILE &optional SAVE-AFTER OUTFILE)
Update the autoloads for FILE. If prefix arg SAVE-AFTER is non-nil, save the buffer too.
If FILE binds
generated-autoload-file' as a file-local variable, autoloads are written into that file. Otherwise, the autoloads file is determined by OUTFILE. If called interactively, prompt for OUTFILE; if called from Lisp with OUTFILE nil, use the existing value of
generated-autoload-file'.
So from this information I figured I should be able to supply a non-nil OUTFILE argument. However, trying to run (from scratch buffer) :
(update-file-autoloads "~/emacs/my-lib.el" t "~/emacs/my-lib-autoload.el")
Gives error wrong-type-argument stringp nil
The following two approaches work though:
Setting
generated-autoload-file
as a global variable, for example adding(setq generated-autoload-file "~/emacs/my-lib-autoload.el")
to my Emacs init file (~/.emacs
)Adding
generated-autoload-file
as a local file variable at the end of file~/emacs/my-lib.el
For example:
;; Local Variables:
;; generated-autoload-file: "~/emacs/my-lib-autoload.el"
;; End:
Question:
Why does not
(update-file-autoloads "~/emacs/my-lib.el" t "~/emacs/my-lib-autoload.el")
work when the variable generated-autoload-file
is nil
?