I've got a standard function that seems to disappear on launch. After about a half an hour to an hour of use the function becomes available again. (avy-org-refile-as-child)

The function appears to be completely gone until it shows up. When missing, I can't call it and M-x describe-function doesn't list it. After it shows up everything works as normal.

When missing, no other emacs functionality appears compromised. Even most other avy functions work as expected except avy-org-goto-heading-timer which also vanishes with avy-org-refile-as-child.

This one has me stumped - I don't even know how to being to troubleshoot this.

2 Answers 2


avy-org-refile-as-child is not a "standard" function, in the sense that it is not built-in to the emacs image. So the function does not "disappear": it is not present to begin with. It will only appear when the library where the function is defined, avy.el[c], is loaded (with load-library, require or through an autoload).

You can force the loading of the library by adding (require 'avy) to your init file. You can add it at the beginning (if you need the function during the loading of the rest of the init file) or at the end (if you want it to be available immediately after the init file is loaded).

Or you can wait for the appropriate autoload to happen as @db48x describes in his answer.


Make sure that there is an autoload definition for them.

Functions don’t exist until Emacs actually reads and executes the file that defines them. Emacs comes with many thousands of such files, so it could not possibly read and execute them all at startup without making the user wait. Instead, Emacs reads just a file containing autoloads. This file tells Emacs, as a quick example, that there is a function called foo-bar in the file foo.el. Emacs stores that information in the symbol foo-bar so that it remembers it for later, then continues on its way. Later, if you ever try to call the function foo-bar, it knows that the function exists but it will have to pause and actually read and execute foo.el first. This happens transparently.

I recon that avy-org-refile-as-child is defined in some file, perhaps avy-org.el. If Emacs had an autoload for this function, it would tell you that the function exists, but clearly it doesn’t. What it does have is an autoload for some other function or functions in that same file. If you call one of them, then Emacs reads and executes avy-org.el and that is when avy-org-refile-as-child also shows up.

So, to fix this you must find out where that function is defined, then find and update the corresponding autoloads. The function loaddefs-generate may be able to assist you in this, but read chapter 15 Autoloads for details on how to use it. Specifically, look for information about how to use autoload cookies.

  • This helped me to get a better understanding of what's going on here. Thanks.
    – cochrane12
    Mar 3 at 16:53
  • You’re welcome.
    – db48x
    Mar 3 at 17:02

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.