Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid deprecation warning with autoloading #2891

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions el-get-autoloading.el
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-custom)
(require 'autoload)
(eval-and-compile
(or (require 'loaddefs-gen nil 'noerror)
(require 'autoload)))

(declare-function el-get-package-is-installed "el-get" (package))
(declare-function el-get-byte-compile-file "el-get-byte-compile" (el))
Expand Down Expand Up @@ -49,6 +51,21 @@

(defvar recentf-exclude)

(defun el-get-update-directory-autoloads (dir)
"A wrapper function to update autoload definitions of DIR.

We need this wrapper because
Emacs 28.1 replaces `update-directory-autoloads' with
`make-directory-autoloads', and Emacs 29 with
`loaddefs-generate'."
(cond
((fboundp 'loaddefs-generate)
(loaddefs-generate dir generated-autoload-file))
((fboundp 'make-directory-autoloads)
(make-directory-autoloads dir generated-autoload-file))
((fboundp 'update-directory-autoloads)
(update-directory-autoloads dir))))

(defun el-get-update-autoloads (package)
"Regenerate, compile, and load any outdated packages' autoloads."
(when (el-get-want-autoloads-p package)
Expand Down Expand Up @@ -79,7 +96,7 @@
(el-get-ensure-byte-compilable-autoload-file generated-autoload-file)

(when (el-get-package-is-installed package)
(mapc 'update-directory-autoloads
(mapc 'el-get-update-directory-autoloads
(cl-remove-if-not #'file-directory-p
(el-get-load-path package)))

Expand Down