Skip to content
Open
Show file tree
Hide file tree
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
64 changes: 53 additions & 11 deletions el-get-autoloading.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; el-get.el --- Manage the external elisp bits and pieces you depend upon
;;; el-get.el --- Manage the external elisp bits and pieces you depend upon -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2010-2011 Dimitri Fontaine
;;
Expand All @@ -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 All @@ -25,6 +27,14 @@
(defvar el-get-outdated-autoloads nil
"List of package names whose autoloads are outdated")

(defun el-get-autoload-rubric (file &optional type feature compile)
"A wrapper function emulating autoload-rubric."
(cond
((fboundp 'loaddefs-generate--rubric)
(loaddefs-generate--rubric file type feature compile))
((fboundp 'autoload-rubric)
(autoload-rubric file type feature))))

(defun el-get-ensure-byte-compilable-autoload-file (file)
"If FILE doesn't already exist, create it as a byte-compilable
autoload file (the default created by autoload.el has a local
Expand All @@ -34,7 +44,7 @@
(unless (file-exists-p file)
(write-region
(replace-regexp-in-string ";; no-byte-compile: t\n" ""
(autoload-rubric file)) nil file)))
(el-get-autoload-rubric file)) nil file)))

(defun el-get-load-fast (file)
"Load the compiled version of FILE if it exists; else load FILE verbatim"
Expand All @@ -49,6 +59,35 @@

(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-autoload-file-load-name (file &optional outfile)
"A wrapper function to compute the name that will be used to load FILE.

OUTFILE should be the name of the global loaddefs.el file."
(cond
((fboundp 'loaddefs-generate--file-load-name)
(loaddefs-generate--file-load-name file outfile))
((fboundp 'autoload-file-load-name)
(apply #'autoload-file-load-name
(if (> emacs-major-version 27)
`(,file ,outfile)
`(,file))))))

(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 +118,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 Expand Up @@ -114,7 +153,7 @@ with the named PACKAGE"
(load-names
(mapcar
(lambda (f)
(apply #'autoload-file-load-name
(apply #'el-get-autoload-file-load-name
;; Starting from Emacs 28 auto-file-load-name
;; needs two parameters, versions before 28 only
;; one.
Expand All @@ -125,12 +164,15 @@ with the named PACKAGE"
(recentf-exclude (cons (regexp-quote el-get-autoload-file)
(bound-and-true-p recentf-exclude)))
(visited (find-buffer-visiting el-get-autoload-file)))
(with-current-buffer (or visited (find-file-noselect el-get-autoload-file))
(widen) (goto-char (point-min))
(while (search-forward generate-autoload-section-header nil t)
(when (member (nth 2 (autoload-read-section-header)) load-names)
;; We found a matching section, remove it.
(autoload-remove-section (match-beginning 0)))))
(when (and (boundp 'generate-autoload-section-header)
(fboundp 'autoload-remove-section)
(fboundp 'autoload-read-section-header))
(with-current-buffer (or visited (find-file-noselect el-get-autoload-file))
(widen) (goto-char (point-min))
(while (search-forward generate-autoload-section-header nil t)
(when (member (nth 2 (autoload-read-section-header)) load-names)
;; We found a matching section, remove it.
(autoload-remove-section (match-beginning 0))))))
(el-get-update-autoloads package)
(let ((visiting (find-buffer-visiting el-get-autoload-file)))
(when visiting
Expand Down
8 changes: 4 additions & 4 deletions el-get-build.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; el-get --- Manage the external elisp bits and pieces you depend upon
;;; el-get --- Manage the external elisp bits and pieces you depend upon -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2010-2011 Dimitri Fontaine
;;
Expand Down Expand Up @@ -187,9 +187,9 @@ recursion.
infodir-rel))

(defun el-get-install-or-init-info (package build-or-init)
"Call `el-get-install-info' to create the necessary \"dir\"
file when build-or-init is 'build, or `el-get-set-info-path'
when build-or-init is 'init "
"Calls el-get-install-info to create the necessary \"dir\"
file when build-or-init is \\='build, or el-get-set-info-path
when build-or-init is \\='init "
(let* ((source (el-get-package-def package))
(method (el-get-package-method source))
(infodir (plist-get source :info))
Expand Down
10 changes: 5 additions & 5 deletions el-get-bundle.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; el-get-bundle.el --- An el-get wrapper
;;; el-get-bundle.el --- An el-get wrapper -*- lexical-binding: t; -*-

;; Author: INA Lintaro <tarao.gnn at gmail.com>
;; URL: https://github.com/tarao/bundle-el/tree/el-get
Expand All @@ -24,12 +24,12 @@
:group 'el-get-bundle)

(defcustom el-get-bundle-sync t
"t means to run el-get with the argument 'sync.
"t means to run el-get with the argument \\='sync.
The default can be overriden on a per-package basis by adding one of
`:bundle-async [t|nil]'
`:bundle-sync [t|nil]
`:bundle-async [t|nil]\\='
`:bundle-sync [t|nil]\\='
to the list of keywords that follow
`el-get-bundle PACKAGE|el-get-bundle FEATURE in PACKAGE'."
`el-get-bundle PACKAGE|el-get-bundle FEATURE in PACKAGE\\='."
:type 'boolean
:group 'el-get-bundle)

Expand Down
2 changes: 1 addition & 1 deletion el-get-byte-compile.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; el-get --- Manage the external elisp bits and pieces you depend upon
;;; el-get --- Manage the external elisp bits and pieces you depend upon -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2010-2011 Dimitri Fontaine
;;
Expand Down
2 changes: 1 addition & 1 deletion el-get-check.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; el-get-recipes.el --- Manage the external elisp bits and pieces you depend upon
;;; el-get-recipes.el --- Manage the external elisp bits and pieces you depend upon -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2010-2011 Dimitri Fontaine
;;
Expand Down
9 changes: 4 additions & 5 deletions el-get-core.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; el-get-core.el --- Manage the external elisp bits and pieces you depend upon
;;; el-get-core.el --- Manage the external elisp bits and pieces you depend upon -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2010-2011 Dimitri Fontaine
;;
Expand All @@ -22,7 +22,6 @@
(require 'cl-lib)
(require 'simple) ; needed for `apply-partially'
(require 'bytecomp)
(require 'autoload)

(declare-function el-get-package-def "el-get-recipes" (package))
(declare-function el-get-installation-failed "el-get" (package signal-data))
Expand Down Expand Up @@ -250,8 +249,8 @@ entry."
(defun el-get-flatten (arg)
"Return a version of ARG as a one-level list

(el-get-flatten 'x) => '(x)
(el-get-flatten '(a (b c (d)) e)) => '(a b c d e)"
(el-get-flatten \\='x) => \\='(x)
(el-get-flatten \\='(a (b c (d)) e)) => \\='(a b c d e)"
(if (listp arg)
(apply 'append (mapcar 'el-get-flatten arg))
(list arg)))
Expand Down Expand Up @@ -493,7 +492,7 @@ makes it easier to conditionally splice a command into the list.
;; lists. This allows
;; `el-get-start-process-list' (but not other
;; functions) to recurse indefinitely.
(let ((max-specpdl-size (+ 100 max-specpdl-size)))
(let ((max-lisp-eval-depth (+ 100 max-lisp-eval-depth)))
(el-get-start-process-list package next final-func))
(when (functionp final-func)
(funcall final-func package)))))
Expand Down
Loading
Loading