An Eshell module is defined the same as any other library but with two
additional requirements: first, the module’s source file should be
named em-name.el; second, the module must define an
autoloaded Customize group (see Customization in The Emacs
Lisp Reference Manual) with eshell-module
as the parent group.
In order to properly autoload this group, you should wrap its
definition with progn
as follows:
;;;###autoload (progn (defgroup eshell-my-module nil "My module lets you do very cool things in Eshell." :tag "My module" :group 'eshell-module))
Even if you don’t have any Customize options in your module, you
should still define the group so that Eshell can include your module
in the Customize interface for eshell-modules-list
.