It is clear that not all local/custom/personal packages should be officially released, and it would be silly to do so just to benefit from built-in package management support. I'm wondering how to generate and activate autoloads for local packages? That is similar to how package.el does it for the installed packages from ELPA. In order to avoid reinventing the wheel, is there a way for it to "pretend" that some local directory (with subdirectories each of which is a local/custom/personal package) is ELPA? I'm also open to el-get if such a scenario can be supported via, for example, custom recipes.

I'm sure the task is pretty common and anybody who uses Emacs on advanced level comes to that point sooner or later. Could anybody share their experiences in this field?

  • 3
    update-directory-autoloads can be used independently of any package manager.
    – npostavs
    Commented Jun 18, 2017 at 13:37
  • @npostavs, I know but it's not recursive and it's not a comprehensive solution in this case. For sure it will be not enough and I would have to wrap it into my own implementation. Commented Jun 18, 2017 at 13:51
  • 1. You can provide a list of dirs (e.g., a dir and its descendants) to update-directory-autoloads, to, in effect, make it recursive. 2. You can use update-file-autoloads for every file you are interested in, regardless of which directory it is in.
    – Drew
    Commented Jun 18, 2017 at 17:07
  • FYI: package.el is also non-recursive (i.e., it doesn't support packages with sources in subdirectories).
    – npostavs
    Commented Jun 18, 2017 at 18:01
  • I set up a local MELPA on Linux. I don't have any good solution for windows. I really wish emacs would support this type of thing out of the box. Might be worth checking use-package to see if it can. Commented Jun 20, 2017 at 12:25

3 Answers 3


The correct solution (IMO) is to use a package manager which has explicit support for this use case. This would be straight.el, which I wrote for this purpose.

You can read verbose documentation, including comparisons to other package managers, in the README, so I'll stick to how you can use straight.el to solve your specific problem.

  1. Place your repository in ~/.emacs.d/straight/repos/<my-repo>.
  2. Load it using

    (straight-use-package '(<my-package> :local-repo "<my-repo>"))
  3. You're done. Whenever you make changes to the source code, autoload generation and byte-compilation will be redone (at next Emacs startup). You also get things like dependency management, optional version control automation, etc. for free.

  4. When (if) you want to publish the package, just push it somewhere and modify the recipe to point to that Git repository.
  5. You can also use straight.el with use-package if you prefer (it's just syntax sugar for the most part).

If you have replaced an already installed package with a different version, and all you are missing is the autoloads file, you can use package-generate-autoloads to generate it:

(package-generate-autoloads "async" "~/.emacs.d/elpa/async-1.9.3/")

I found it easier then using update-directory-autotools when I need to downgrade a package to an earlier version.

Actually I think I have not really answered your question. I'll leave this answer here for the time being but my answer is more relevant here: https://stackoverflow.com/questions/26348561/how-to-generate-autoloads-for-elpa-packages/50100170


I do the following on Linux:

I setup a local melpa repository by cloning melpa.

I modify the recipes I want to point to my local packages. The following is local-melpa/recipies/ace-window

  :url "/home/my_home/.emacs.d/packages/ace-window/"
  :fetcher git)

Then from local-mepla type make all or make recipies/ace-window to build the package(s) in local-melpa/packages

Then make packages/archive-contents, which populates the list of packages.

Then in use to following to tell emacs to use my local melpa

(setq package-archives '(("local-melpa" . "~/.emacs.d/packages/local-melpa/packages/")))

I haven't figured out how to run make on windows. But I can build the packages in local-melpa on Linux and copy it over to windows and emacs understands and installs the packages properly.

The benefit of this is I can reset anytime I want by deleting my ~/.emacs.d/elpa/* directory and installing any custom updates to any package.

  • Perhaps quelpa would also be of interest?
    – npostavs
    Commented Jul 25, 2017 at 0:31
  • I think you are right npostavs. I have to sit down and look at it. Commented Jul 25, 2017 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.