Make autoloading optional, both globally and per-package, and disable it for session.el, which has bad autoloads

See https://github.com/dimitri/el-get/issues/issue/111/ for the background on this.
This commit is contained in:
Steve Purcell 2011-01-31 15:50:41 +00:00 committed by Dimitri Fontaine
parent 154b320960
commit ac45346a7d
2 changed files with 39 additions and 16 deletions

View File

@ -140,6 +140,12 @@ disable byte-compilation globally."
:group 'el-get :group 'el-get
:type 'boolean) :type 'boolean)
(defcustom el-get-generate-autoloads t
"Whether or not to generate autoloads for packages. Can be used
to disable autoloads globally."
:group 'el-get
:type 'boolean)
(defvar el-get-git-clone-hook nil "Hook run after git clone.") (defvar el-get-git-clone-hook nil "Hook run after git clone.")
(defvar el-get-git-svn-clone-hook nil "Hook run after git svn clone.") (defvar el-get-git-svn-clone-hook nil "Hook run after git svn clone.")
(defvar el-get-bzr-branch-hook nil "Hook run after bzr branch.") (defvar el-get-bzr-branch-hook nil "Hook run after bzr branch.")
@ -379,6 +385,12 @@ definition provided by `el-get' recipes locally.
List of features el-get will `require' for you. List of features el-get will `require' for you.
:autoloads
Control whether el-get should generate autoloads for this
package. Setting this to nil prevents el-get from generating
autoloads for the package. Default is t.
:options :options
Currently used by http-tar and cvs support. Currently used by http-tar and cvs support.
@ -1795,8 +1807,9 @@ that has a valid recipe."
(defun el-get-eval-autoloads () (defun el-get-eval-autoloads ()
"Evaluate the autoloads from the autoload file." "Evaluate the autoloads from the autoload file."
(message "el-get: evaluating autoload file") (when el-get-generate-autoloads
(el-get-load-fast el-get-autoload-file)) (message "el-get: evaluating autoload file")
(el-get-load-fast el-get-autoload-file)))
(defun el-get-update-autoloads () (defun el-get-update-autoloads ()
"Regenerate, compile, and load any outdated packages' autoloads. "Regenerate, compile, and load any outdated packages' autoloads.
@ -1836,33 +1849,42 @@ shouldn't be invoked directly."
(defun el-get-remove-autoloads (package) (defun el-get-remove-autoloads (package)
"Remove from `el-get-autoload-file' any autoloads associated "Remove from `el-get-autoload-file' any autoloads associated
with the named PACKAGE" with the named PACKAGE"
(with-temp-buffer ;; empty buffer to trick `autoload-find-destination' (when (file-exists-p el-get-autoload-file)
(let ((generated-autoload-file el-get-autoload-file) (with-temp-buffer ;; empty buffer to trick `autoload-find-destination'
(autoload-modified-buffers (list (current-buffer)))) (let ((generated-autoload-file el-get-autoload-file)
(dolist (dir (el-get-load-path package)) (autoload-modified-buffers (list (current-buffer))))
(when (file-directory-p dir) (dolist (dir (el-get-load-path package))
(dolist (f (directory-files dir t el-get-load-suffix-regexp)) (when (file-directory-p dir)
;; this will clear out any autoloads associated with the file (dolist (f (directory-files dir t el-get-load-suffix-regexp))
;; `autoload-find-destination' signature has changed in emacs24. ;; this will clear out any autoloads associated with the file
(if (> emacs-major-version 23) ;; `autoload-find-destination' signature has changed in emacs24.
(autoload-find-destination f (autoload-file-load-name f)) (if (> emacs-major-version 23)
(autoload-find-destination f))))))) (autoload-find-destination f (autoload-file-load-name f))
(el-get-save-and-kill el-get-autoload-file)) (autoload-find-destination f)))))))
(el-get-save-and-kill el-get-autoload-file)))
(defvar el-get-autoload-timer nil (defvar el-get-autoload-timer nil
"Where the currently primed autoload timer (if any) is stored") "Where the currently primed autoload timer (if any) is stored")
(defun el-get-want-autoloads-p (package)
(let ((source (el-get-package-def package)))
(or (not (plist-member source :autoloads))
(plist-get source :autoloads))))
(defun el-get-invalidate-autoloads ( &optional package ) (defun el-get-invalidate-autoloads ( &optional package )
"Mark the named PACKAGE as needing new autoloads. If PACKAGE "Mark the named PACKAGE as needing new autoloads. If PACKAGE
is nil, marks all installed packages as needing new autoloads." is nil, marks all installed packages as needing new autoloads."
;; Trigger autoload recomputation unless it's already been done ;; Trigger autoload recomputation unless it's already been done
(unless el-get-autoload-timer (unless (or el-get-autoload-timer
(not el-get-generate-autoloads))
(setq el-get-autoload-timer (setq el-get-autoload-timer
(run-with-idle-timer 0 nil 'el-get-update-autoloads))) (run-with-idle-timer 0 nil 'el-get-update-autoloads)))
;; Save the package names for later ;; Save the package names for later
(mapc (lambda (p) (add-to-list 'el-get-outdated-autoloads p)) (mapc (lambda (p)
(when (el-get-want-autoloads-p p)
(add-to-list 'el-get-outdated-autoloads p)))
(if package (list package) (if package (list package)
(mapcar 'el-get-source-name el-get-sources))) (mapcar 'el-get-source-name el-get-sources)))

View File

@ -4,4 +4,5 @@
:load-path ("lisp") :load-path ("lisp")
:url "http://downloads.sourceforge.net/project/emacs-session/session/2.2a/session-2.2a.tar.gz" :url "http://downloads.sourceforge.net/project/emacs-session/session/2.2a/session-2.2a.tar.gz"
:info "session management" :info "session management"
:autoloads nil
) )