I am trying to figure out how to add autoload features to a private library. Let's say I have developed a private Lisp library "my-lib.el". It consist of a set of functions, some can be used from any mode, others are only used for a particular mode. According to the manual I could put a autoload cookie above each function definition, and then call update-file-autoloads. Is this correct? But when do I call update-file-autoloads? In the beginning of the Emacs init file?
For example, in my ~/.emacs init file, I could write:
(update-file-autoloads "my-lib.el")
(require 'my-lib)
Where in "my-lib.el"
;;;###autoload
(defun my-func()
(interactive)
(message "Hello"))
;;; more functions, omitted here...
(provide 'my-lib)
But this gives error from update-file-autoloads if the file is not in the current directory. Or if "my-lib.el" is in the current directory, I get the error: Wrong type argument: stringp, nil.
My aim is to be able to type M-x my-func (as an example), and my-func should autoload at that point if this was the first time I called it.