I am having issues with autoloading of elpa packages under different versions of emacs (under macOS if that matters).
My ~/.emacs.d is a link to somewhere else.
Take as an example amx
The loading works under emacs 25 and 27 but not under 28. The error is like Cannot open load file: No such file or directory, ../../../../../../../.emacs.d/elpa/28/amx-20210305.118/amx.el The load-path is correct for each version
The packages are loaded into a different path for each version using this code in early-init.el
(setq package-user-dir
(expand-file-name
(format "elpa/%s" emacs-major-version) user-emacs-directory))
I think the issue is with the generated amx-autoloads.el file and is the last line
emacs 25 has no register-definition-prefixes
emacs 27
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "amx" '("amx-")))
emacs 28
(register-definition-prefixes "../../../../../../../.emacs.d/elpa/28/amx-20210305.118/amx" '("amx-"))
In this file the generated comments are
emacs 25 -
;;;### (autoloads nil "amx" "amx.el" (24783 47304 949021 880000))
;;; Generated autoloads from amx.el
emacs 27
;;;### (autoloads nil "amx" "../../../../../../../.emacs.d/elpa/27/amx-20210305.118/amx.el"
;;;;;; "a034ecc8682671a85a9465e1b8dcc78e")
;;; Generated autoloads from ../../../../../../../.emacs.d/elpa/27/amx-20210305.118/amx.el
emacs 28
;;;### (autoloads nil "../../../../../../../.emacs.d/elpa/28/amx-20210305.118/amx"
;;;;;; "../../../../../../../.emacs.d/elpa/28/amx-20210305.118/amx.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from ../../../../../../../.emacs.d/elpa/28/amx-20210305.118/amx.el
So I think the problem is that emacs uses the relative path to a directrory in some places and uses the realpath (ie expands the symbolic link) rather than the path under ~/.emacs.d
How can I control the generation of the -autoloads.el files so that the expanded path is ideally not used as in emacs 25 or at least as in emacs 27 not really used.
I suspect that this question is the same issue but it has no answers
default-directory
is buffer-local. It changes every time you visit a file in a different directory. Definitely a bug if it uses a relative path anywhere.Name of default directory of current buffer. It should be an absolute directory name; on GNU and Unix systems, these names start with
/' or~' and end with
/'.`