Commit d30ddb78 authored by Noam Postavsky's avatar Noam Postavsky

fix byte compile warnings

Move more variables to el-get-custom.el, add requires or
declare-functions as needed.

There were a few places that appeared to be actual bugs: wrong or
missing variable names.
parent e3fab82e
......@@ -14,8 +14,14 @@
(require 'cl)
(require 'el-get-core)
(require 'el-get-custom)
(require 'autoload)
(declare-function el-get-package-is-installed "el-get" (package))
(declare-function el-get-byte-compile-file "el-get-byte-compile" (el))
(declare-function el-get-package-def "el-get-recipes" (package))
(declare-function el-get-list-package-names-with-status "el-get-status" (&rest statuses))
(defvar el-get-outdated-autoloads nil
"List of package names whose autoloads are outdated")
......
......@@ -14,6 +14,9 @@
(require 'el-get-core)
(require 'el-get-byte-compile)
(require 'el-get-recipes)
(declare-function info-initialize "info" nil)
;; debian uses ginstall-info and it's compatible to fink's install-info on
;; MacOSX, so:
......
......@@ -14,6 +14,9 @@
(require 'cl) ; yes I like loop
(require 'bytecomp)
(require 'el-get-status)
(declare-function el-get-build-commands "el-get-build" (package))
;; byte-recompile-file:
;;
......
......@@ -24,6 +24,9 @@
(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))
(defun el-get-print-to-string (object &optional pretty)
"Return string representation of lisp object.
......
......@@ -23,6 +23,8 @@
(require 'el-get-core)
(declare-function widget-editable-list-match "wid-edit" (widget value))
;;; First, some essential variables, used in other parts of the code.
(defgroup el-get nil "el-get customization group"
:group 'convenience)
......@@ -47,7 +49,90 @@
(defvar el-get-emacs (concat invocation-directory invocation-name)
"Where to find the currently running emacs, a facility for :build commands")
;;
;; Define some code-level customs.
;;
(defcustom el-get-post-init-hooks nil
"Hooks to run after a package init.
Each hook is a unary function accepting a package"
:group 'el-get
:type 'hook)
(defcustom el-get-post-install-hooks nil
"Hooks to run after installing a package.
Each hook is a unary function accepting a package"
:group 'el-get
:type 'hook)
(defcustom el-get-post-update-hooks nil
"Hooks to run after updating a package.
Each hook is a unary function accepting a package"
:group 'el-get
:type 'hook)
(defcustom el-get-post-error-hooks nil
"Hooks to run after package installation fails.
Each hook is a binay function accepting a package and error data"
:group 'el-get
:type 'hook)
(defcustom el-get-byte-compile t
"Whether or not to byte-compile packages. Can be used to
disable byte-compilation globally, unless this process is not
controlled by `el-get' itself.
The cases when `el-get' loses control are with \"advanced\"
packaging systems (apt-get, fink, pacman, elpa) or when the
recipe contains a :build rule (using a Makefile for example)."
:group 'el-get
:type 'boolean)
(defcustom el-get-verbose nil
"Non-nil means print messages describing progress of el-get even for fast operations."
:group 'el-get
:type 'boolean)
(defcustom el-get-byte-compile-at-init nil
"Whether or not to byte-compile packages at init.
Turn this to t if you happen to update your packages from under
`el-get', e.g. doing `cd el-get-dir/package && git pull`
directly."
:group 'el-get
: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)
(defcustom el-get-is-lazy nil
"Whether or not to defer evaluation of :post-init and :after
functions until libraries are required. Will also have el-get
skip the :load and :features properties when set. See :lazy to
force their evaluation on some packages only."
:group 'el-get
:type 'boolean)
(defcustom el-get-auto-update-cached-recipes t
"When non-nil, auto-update certain properties in cached recipes.
When El-get installs a package, it stores a copy of the package's
recipe that becomes independent from the recipe in
`el-get-sources'. The cached copy is updated only when the
package itself is updated or reinstalled. However, if this
preference is t (the default), select properties of the cached
recipe copy will be updated from `el-get-sources' whenever the
package is initialized (see
`el-get-status-recipe-updatable-properties').
If this is set to nil, then the cached copy will *only* be
updated when the package itself is."
:group 'el-get
:type 'boolean)
;;; "Fuzzy" data structure customization widgets
(defun el-get-repeat-value-to-internal (widget element-or-list)
(el-get-as-list element-or-list))
......
......@@ -14,6 +14,7 @@
(require 'cl)
(require 'el-get-core)
(require 'el-get-recipes)
(defun el-get-dependencies (packages)
"Return the list of packages to install in order."
......@@ -22,7 +23,7 @@
(apply 'append (mapcar 'el-get-dependencies-graph (el-get-as-list packages))))
(if all-sorted-p
plist
(error "Couldn't sort package dependencies for \"%s\"" package))))
(error "Couldn't sort package dependencies for \"%s\"" packages))))
(defun el-get-dependencies-graph (package)
"Return the graph of packages on which PACKAGE depends"
......@@ -53,14 +54,14 @@ hash-tables. Topological-sort returns two values. The first is a
list of objects sorted toplogically. The second is a boolean
indicating whether all of the objects in the input graph are present
in the topological ordering (i.e., the first value)."
(let ((entries (make-hash-table :test test))
;; avoid obsolete `flet' & backward-incompatible `cl-flet'
(entry (lambda (v)
"Return the entry for vertex. Each entry is a cons whose
(let* ((entries (make-hash-table :test test))
;; avoid obsolete `flet' & backward-incompatible `cl-flet'
(entry (lambda (v)
"Return the entry for vertex. Each entry is a cons whose
car is the number of outstanding dependencies of vertex
and whose cdr is a list of dependants of vertex."
(or (gethash v entries)
(puthash v (cons 0 '()) entries)))))
(or (gethash v entries)
(puthash v (cons 0 '()) entries)))))
;; populate entries initially
(dolist (gvertex graph)
(destructuring-bind (vertex &rest dependencies) gvertex
......
;;; el-get-install.el --- installer for the lazy
;;; el-get-install.el --- installer for the lazy -*- no-byte-compile: t -*-
;;
;; Copyright (C) 2010 Dimitri Fontaine
;;
......
......@@ -19,6 +19,11 @@
(require 'el-get-core)
(require 'cl)
(declare-function el-get-install "el-get" (package))
(declare-function el-get-remove "el-get" (package))
(declare-function el-get-update "el-get" (package))
(declare-function el-get-read-package-name "el-get" (action &optional filtered))
(defvar el-get-package-menu-buffer nil
"Global var holding pointing to the package menu buffer, so
that it can be updated from `el-get-save-package-status'")
......
......@@ -23,6 +23,9 @@
(require 'pp)
(require 'el-get-core)
(declare-function el-get-install "el-get" (package))
(declare-function el-get-package-is-installed "el-get" (package))
(defun el-get-package-name (package-symbol)
"Returns a package name as a string."
(cond ((keywordp package-symbol)
......@@ -96,9 +99,9 @@
"Convert OLD-STATUS-LIST, a property list, to the new format"
;; first backup the old status just in case
(with-temp-file (format "%s.old" el-get-status-file)
(insert (el-get-print-to-string ps)))
(insert (el-get-print-to-string old-status-list)))
;; now convert to the new format, fetching recipes as we go
(loop for (p s) on ps by 'cddr
(loop for (p s) on old-status-list by 'cddr
for psym = (el-get-package-symbol p)
when psym
collect
......
......@@ -191,90 +191,6 @@
(require 'el-get-list-packages) ; menu and `el-get-describe' facilities
(require 'el-get-autoloads) ; manages updating el-get's loaddefs.el
;;
;; Define some code-level customs. They stay here so that it's easier
;; for elisp programmers to find them and know about them. If that is
;; too lame of an excuse, let's move them to el-get-custom.el.
;;
(defcustom el-get-post-init-hooks nil
"Hooks to run after a package init.
Each hook is a unary function accepting a package"
:group 'el-get
:type 'hook)
(defcustom el-get-post-install-hooks nil
"Hooks to run after installing a package.
Each hook is a unary function accepting a package"
:group 'el-get
:type 'hook)
(defcustom el-get-post-update-hooks nil
"Hooks to run after updating a package.
Each hook is a unary function accepting a package"
:group 'el-get
:type 'hook)
(defcustom el-get-post-error-hooks nil
"Hooks to run after package installation fails.
Each hook is a binay function accepting a package and error data"
:group 'el-get
:type 'hook)
(defcustom el-get-byte-compile t
"Whether or not to byte-compile packages. Can be used to
disable byte-compilation globally, unless this process is not
controlled by `el-get' itself.
The cases when `el-get' loses control are with \"advanced\"
packaging systems (apt-get, fink, pacman, elpa) or when the
recipe contains a :build rule (using a Makefile for example)."
:group 'el-get
:type 'boolean)
(defcustom el-get-verbose nil
"Non-nil means print messages describing progress of el-get even for fast operations."
:group 'el-get
:type 'boolean)
(defcustom el-get-byte-compile-at-init nil
"Whether or not to byte-compile packages at init.
Turn this to t if you happen to update your packages from under
`el-get', e.g. doing `cd el-get-dir/package && git pull`
directly."
:group 'el-get
: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)
(defcustom el-get-is-lazy nil
"Whether or not to defer evaluation of :post-init and :after
functions until libraries are required. Will also have el-get
skip the :load and :features properties when set. See :lazy to
force their evaluation on some packages only."
:group 'el-get
:type 'boolean)
(defcustom el-get-auto-update-cached-recipes t
"When non-nil, auto-update certain properties in cached recipes.
When El-get installs a package, it stores a copy of the package's
recipe that becomes independent from the recipe in
`el-get-sources'. The cached copy is updated only when the
package itself is updated or reinstalled. However, if this
preference is t (the default), select properties of the cached
recipe copy will be updated from `el-get-sources' whenever the
package is initialized (see
`el-get-status-recipe-updatable-properties').
If this is set to nil, then the cached copy will *only* be
updated when the package itself is."
:group 'el-get
:type 'boolean)
(defvar el-get-next-packages nil
"List of packages to install next, used when dealing with dependencies.")
......@@ -532,7 +448,7 @@ called by `el-get' (usually at startup) for each installed package."
(funcall maybe-lazy-eval `(el-get-load-package-user-init-file ',package))
(funcall el-get-maybe-lazy-runsupp
after "after" package)))
(debug error
(debug err
(el-get-installation-failed package err)))
;; and call the global init hooks
(run-hook-with-args 'el-get-post-init-hooks package)
......@@ -728,7 +644,7 @@ different install methods."
"Update "
(el-get-error-unless-package-p package)
(assert (el-get-package-is-installed package) nil
"Package %s cannot be updated because it is not installed.")
"Package %s cannot be updated because it is not installed." package)
(let* ((package (el-get-as-symbol package))
(source (el-get-package-def package))
(method (el-get-package-method source))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment