Replace cl by cl-lib

Since Emacs 27 the package cl is deprecated, the replacement is
cl-lib, which is available since Emacs 24.3.

This patch replaces cl by cl-lib and drops support for Emacs versions
less than 24.3. Dropping older Emacsen is required, because cl-lib is
a builtin starting from version 24.3 and doesn't need an extra package
from ELPA.

Testcases for past issues still contain cl. Most of them seem to be
broken and need further investigation.

This patch is tested with test/run-ert.sh, which outputs:

Ran 10 tests, 10 results as expected, 0 unexpected (2021-01-30 13:24:54+0100, 0.672122 sec)
1 expected failures

and manually by daily usage for a month now.
This commit is contained in:
Stephan Creutz 2021-01-30 13:17:05 +01:00
parent 99c828f01d
commit ccca97f226
25 changed files with 417 additions and 401 deletions

View File

@ -58,7 +58,7 @@ packages providing some.
# Installation
El-Get is easy to install. The only requirements to do so successfully are
Emacs (23.4 and above), `git` and a connection to the internet that allows you to `git clone`
Emacs (24.3 and above), `git` and a connection to the internet that allows you to `git clone`
repositories.
If you do not already have `git` on your system, you can install it through

View File

@ -12,7 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl)
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-custom)
(require 'autoload)
@ -80,7 +80,7 @@
(when (el-get-package-is-installed package)
(mapc 'update-directory-autoloads
(remove-if-not #'file-directory-p
(cl-remove-if-not #'file-directory-p
(el-get-load-path package)))
(let ((visiting (find-buffer-visiting el-get-autoload-file)))

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-byte-compile)
(require 'el-get-recipes)
@ -65,7 +66,7 @@ Otherwise, use `:build/SYSTEM-TYPE' or `:build'."
;; Verify that each build command is a string or a list of strings
(let ((invalid-cmds
(remove-if (lambda (cmd)
(cl-remove-if (lambda (cmd)
(or (stringp cmd)
(el-get-list-of-strings-p cmd)))
flat-build-commands)))

View File

@ -11,7 +11,7 @@
;;; Code:
(require 'el-get)
(eval-when-compile (require 'cl))
(eval-when-compile (require 'cl-lib))
;; customization
@ -279,7 +279,7 @@ version is used if `el-get-bundle-byte-compile' is non-nil."
(setq form (nthcdr 2 form) require t))
;; parse keywords
(while (keywordp (nth 0 form))
(case (nth 0 form)
(cl-case (nth 0 form)
(:bundle-sync (setq sync (nth 1 form)))
(:bundle-async (setq sync (not (nth 1 form))))
(t (setq src (plist-put src (nth 0 form) (nth 1 form)))))
@ -312,7 +312,7 @@ required."
`(el-get-bundle ,package ,@args)
(let* ((package (or (and (listp package) (nth 1 package)) package))
(name (plist-get (el-get-bundle-parse-name package) :name)))
`(el-get-bundle ,name ,@(list* 'in package args)))))
`(el-get-bundle ,name ,@(cl-list* 'in package args)))))
(provide 'el-get-bundle)
;;; el-get-bundle.el ends here

View File

@ -12,7 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl) ; yes I like loop
(require 'cl-lib) ; yes I like loop
(require 'bytecomp)
(declare-function el-get-build-commands "el-get-build" (package))
@ -103,7 +103,7 @@ newer, then compilation is skipped."
With optional arg RECURSIVE, do so in all subdirectories as well."
;; Process elc files in this dir
(let ((elc-files (directory-files dir 'full "\\.elc$")))
(loop for elc in elc-files
(cl-loop for elc in elc-files
for el = (concat (file-name-sans-extension elc) ".el")
if (and (file-exists-p elc)
(not (file-directory-p elc))
@ -113,7 +113,7 @@ With optional arg RECURSIVE, do so in all subdirectories as well."
(delete-file elc)))
;; Process subdirectories recursively
(when recursive
(loop for dir in (directory-files dir 'full)
(cl-loop for dir in (directory-files dir 'full)
for localdir = (file-name-nondirectory dir)
if (file-directory-p dir)
unless (member localdir '("." ".."
@ -137,7 +137,7 @@ in `:compile-files' will be byte-compiled.
Standard input can also contain a `:clean-directory' property,
whose value is a directory to be cleared of stale elc files."
(assert noninteractive nil
(cl-assert noninteractive nil
"`el-get-byte-compile-from-stdin' is to be used only with -batch")
(let* ((input-data (read-minibuffer ""))
(files (plist-get input-data :compile-files))
@ -150,11 +150,11 @@ whose value is a directory to be cleared of stale elc files."
(unless (or dir-to-clean files)
(warn "Did not get a list of files to byte-compile or a directory to clean. The input may have been corrupted."))
(when dir-to-clean
(assert (stringp dir-to-clean) nil
(cl-assert (stringp dir-to-clean) nil
"The value of `:clean-directory' must be a string.")
(message "el-get-byte-compile: Cleaning stale compiled files in %s" dir-to-clean)
(el-get-clean-stale-compiled-files dir-to-clean 'recursive))
(loop for f in files
(cl-loop for f in files
do (progn
(message "el-get-byte-compile: %s" f)
(el-get-byte-compile-file-or-directory f)))))

View File

@ -19,6 +19,7 @@
;;; Code:
(require 'cl-lib)
(require 'el-get-recipes)
(require 'el-get-build)
@ -68,10 +69,10 @@ Current possibe elements are:
<:level> can be any valid warning level, see `warning-levels'.
See `el-get-check-suppressed-warnings' for possible <warning> values."
(assert noninteractive nil
(cl-assert noninteractive nil
"`el-get-check-recipe-batch' should only be used with -batch")
(setq vc-handled-backends nil) ; avoid loading VC during batch mode
(loop for arg in command-line-args-left
(cl-loop for arg in command-line-args-left
if (string-match "\\`-Wno-\\(.*\\)" arg)
do (push (intern (match-string 1 arg)) el-get-check-suppressed-warnings)
else if (string-match "\\`-W\\(:[-a-z]*\\)" arg)
@ -79,7 +80,7 @@ See `el-get-check-suppressed-warnings' for possible <warning> values."
(setq warning-minimum-level (intern (match-string 1 arg))))
else summing
(if (file-directory-p arg)
(reduce #'+ (directory-files arg t "\\.rcp$" t)
(cl-reduce #'+ (directory-files arg t "\\.rcp$" t)
:key #'el-get-check-recipe-batch-1 :initial-value 0)
(el-get-check-recipe-batch-1 arg))
into errors
@ -123,7 +124,7 @@ FILENAME defaults to `buffer-file-name'."
level el-get-check-warning-buffer)
(when (>= (warning-numeric-level level)
(warning-numeric-level warning-minimum-level))
(incf el-get-check-error-count)))
(cl-incf el-get-check-error-count)))
(defun el-get-check-recipe-in-current-buffer (recipe-file-name)
(let ((inhibit-read-only t)
@ -153,19 +154,19 @@ FILENAME defaults to `buffer-file-name'."
(el-get-check-warning :error
"File name should match recipe name."))
;; Check if userspace property is used.
(loop for key in '(:before :after)
(cl-loop for key in '(:before :after)
for alt in '(:prepare :post-init)
when (plist-get recipe key)
do (el-get-check-warning :warning
"Property %S is for user. Use %S instead."
key alt))
;; Check for misformatted plists
(loop for key in recipe by #'cddr
(cl-loop for key in recipe by #'cddr
unless (keywordp key)
do (el-get-check-warning :warning
"Property %S is not a keyword!"
key))
(destructuring-bind (&key type url autoloads feats builtin
(cl-destructuring-bind (&key type url autoloads feats builtin
&allow-other-keys)
recipe
;; let-binding `features' causes `provide' to throw error
@ -204,17 +205,17 @@ FILENAME defaults to `buffer-file-name'."
expand-file-name shell-quote-argument)))
(dolist (sys '("" "/darwin" "/berkeley-unix" "/windows-nt"))
(let ((unsafe (catch 'unsafe-build
(when (some #'stringp (el-get-build-commands pkg-name 'safe-eval sys))
(when (cl-some #'stringp (el-get-build-commands pkg-name 'safe-eval sys))
(el-get-check-warning :warning
":build%s should be a *list* of string lists." sys))
nil)))
(when unsafe
(el-get-check-warning :debug ":build%s is unsafep: %s" sys unsafe)))))
;; Check for required properties.
(loop for key in '(:description :name)
(cl-loop for key in '(:description :name)
unless (plist-get recipe key)
do (el-get-check-warning :error
"Required property %S is not defined." key))
do (el-get-check-warning
:error "Required property %S is not defined." key))
(with-current-buffer el-get-check-warning-buffer
(insert (format "\n%s: %s error(s) found." recipe-file-name el-get-check-error-count))))
el-get-check-error-count))

View File

@ -19,7 +19,7 @@
;;
(require 'dired)
(require 'cl) ; needed for `remove-duplicates'
(require 'cl-lib)
(require 'simple) ; needed for `apply-partially'
(require 'bytecomp)
(require 'autoload)
@ -56,8 +56,8 @@ the original object."
"Return a list of all keys in PLIST.
Duplicates are removed."
(remove-duplicates
(loop for (k _) on plist by #'cddr
(cl-remove-duplicates
(cl-loop for (k _) on plist by #'cddr
collect k)
:test #'eq))
@ -89,19 +89,19 @@ call for doing the named package action in the given method.")
"Returns t if NAME is a known el-get install method backend, nil otherwise."
(and (el-get-method name :install) t))
(defun* el-get-register-method (name &key install update remove
(cl-defun el-get-register-method (name &key install update remove
install-hook update-hook remove-hook
compute-checksum guess-website)
"Register the method for backend NAME, with given functions"
(let (method-def)
(loop for required-arg in '(install update remove)
(cl-loop for required-arg in '(install update remove)
unless (symbol-value required-arg)
do (error "Missing required argument: :%s" required-arg)
do (setq method-def
(plist-put method-def
(intern (format ":%s" required-arg))
(symbol-value required-arg))))
(loop for optional-arg in '(install-hook update-hook remove-hook
(cl-loop for optional-arg in '(install-hook update-hook remove-hook
compute-checksum guess-website)
if (symbol-value optional-arg)
do (setq method-def
@ -113,7 +113,7 @@ call for doing the named package action in the given method.")
(put 'el-get-register-method 'lisp-indent-function
(get 'prog1 'lisp-indent-function))
(defun* el-get-register-derived-method (name derived-from-name
(cl-defun el-get-register-derived-method (name derived-from-name
&rest keys &key &allow-other-keys)
"Register the method for backend NAME.
@ -241,7 +241,7 @@ entry."
;;
(defun el-get-duplicates (list)
"Return duplicates found in list."
(loop with dups and once
(cl-loop with dups and once
for elt in list
if (member elt once) collect elt into dups
else collect elt into once
@ -276,7 +276,7 @@ given method."
(let* ((method (if (keywordp method-name) method-name
(intern (concat ":" (format "%s" method-name)))))
(actions (plist-get el-get-methods method)))
(assert actions nil
(cl-assert actions nil
"Unknown recipe type: %s" method)
(plist-get actions action)))
@ -327,7 +327,7 @@ fail."
;;
(defun el-get-package-files (pdir)
"Return a list of files loaded from directory PDIR."
(loop with regexp = (format "^%s" (regexp-quote (file-name-as-directory (file-truename pdir))))
(cl-loop with regexp = (format "^%s" (regexp-quote (file-name-as-directory (file-truename pdir))))
for (f . nil) in load-history
when (and (stringp f) (string-match-p regexp (file-truename f)))
collect (if (string-match-p "\\.elc?$" f)
@ -336,10 +336,10 @@ fail."
(defun el-get-package-features (pdir)
"Return a list of features provided by files in PDIR."
(loop with regexp = (format "^%s" (regexp-quote (file-name-as-directory (expand-file-name pdir))))
(cl-loop with regexp = (format "^%s" (regexp-quote (file-name-as-directory (expand-file-name pdir))))
for (f . l) in load-history
when (and (stringp f) (string-match-p regexp (file-truename f)))
nconc (loop for i in l
nconc (cl-loop for i in l
when (and (consp i) (eq (car i) 'provide))
collect (cdr i))))

View File

@ -21,6 +21,7 @@
;; and its methods. See the methods directory for implementation of them.
;;
(require 'cl-lib)
(require 'el-get-core)
(declare-function widget-editable-list-match "wid-edit" (widget value))
@ -515,7 +516,7 @@ this is the name to fetch in that system"
)
;; A sorted list of method names
(sort
(reduce
(cl-reduce
(lambda (r e)
(if (symbolp e)
(cons

View File

@ -12,7 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl)
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-recipes)
@ -28,7 +28,7 @@ attention to case differences."
string start-pos nil ignore-case)))))))
(defun el-get-dependencies (packages)
"Return the list of packages to install in order."
(multiple-value-bind (plist all-sorted-p non-sorted)
(cl-multiple-value-bind (plist all-sorted-p non-sorted)
(topological-sort
(apply 'append (mapcar 'el-get-dependencies-graph (el-get-as-list packages))))
(if all-sorted-p
@ -48,13 +48,13 @@ attention to case differences."
(cons 'package pdeps)
pdeps)))
(append (list (append (list package) alldeps))
(loop for p in pdeps append (el-get-dependencies-graph p)))))
(cl-loop for p in pdeps append (el-get-dependencies-graph p)))))
;;
;; topological sort, see
;; http://rosettacode.org/wiki/Topological_sort#Common_Lisp
;;
(defun* topological-sort (graph &key (test 'eql))
(cl-defun topological-sort (graph &key (test 'eql))
"Returns a list of packages to install in order.
Graph is an association list whose keys are objects and whose
@ -74,32 +74,32 @@ in the topological ordering (i.e., the first value)."
(puthash v (cons 0 '()) entries)))))
;; populate entries initially
(dolist (gvertex graph)
(destructuring-bind (vertex &rest dependencies) gvertex
(cl-destructuring-bind (vertex &rest dependencies) gvertex
(let ((ventry (funcall entry vertex)))
(dolist (dependency dependencies)
(let ((dentry (funcall entry dependency)))
(unless (funcall test dependency vertex)
(incf (car ventry))
(cl-incf (car ventry))
(push vertex (cdr dentry))))))))
;; L is the list of sorted elements, and S the set of vertices
;; with no outstanding dependencies.
(let ((L '())
(S (loop for entry being each hash-value of entries
(S (cl-loop for entry being each hash-value of entries
using (hash-key vertex)
when (zerop (car entry)) collect vertex)))
;; Until there are no vertices with no outstanding dependencies,
;; process vertices from S, adding them to L.
(do* () ((endp S))
(cl-do* () ((cl-endp S))
(let* ((v (pop S)) (ventry (funcall entry v)))
(remhash v entries)
(dolist (dependant (cdr ventry) (push v L))
(when (zerop (decf (car (funcall entry dependant))))
(when (zerop (cl-decf (car (funcall entry dependant))))
(push dependant S)))))
;; return (1) the list of sorted items, (2) whether all items
;; were sorted, and (3) if there were unsorted vertices, the
;; hash table mapping these vertices to their dependants
(let ((all-sorted-p (zerop (hash-table-count entries))))
(values (nreverse L)
(cl-values (nreverse L)
all-sorted-p
(unless all-sorted-p
entries))))))
@ -114,7 +114,7 @@ A `:minimum-emacs-version' property may also be present."
(error "Tried to get Package-Requires of non-installed package, `%s'!" package))
(eval-and-compile
(require 'lisp-mnt)) ; `lm-header'
(loop with deps and min-emacs and sub-pkgs
(cl-loop with deps and min-emacs and sub-pkgs
for pdir in (el-get-load-path package)
do (dolist (file (directory-files pdir t "\\.el\\'" t))
(if (string-suffix-p "-pkg.el" file)
@ -129,9 +129,9 @@ A `:minimum-emacs-version' property may also be present."
(setq deps (nconc (car (read-from-string pkg-reqs)) deps)))))))
finally do
(setq min-emacs (car (cdr (assq 'emacs deps)))
deps (set-difference (remq 'emacs (delete-dups (mapcar #'car deps)))
deps (cl-set-difference (remq 'emacs (delete-dups (mapcar #'car deps)))
sub-pkgs))
(let ((non-el-get-pkgs (remove-if #'el-get-package-def deps)))
(let ((non-el-get-pkgs (cl-remove-if #'el-get-package-def deps)))
(when non-el-get-pkgs
(error "Found non el-get package(s): %s" non-el-get-pkgs)))
finally return
@ -161,7 +161,7 @@ corresponding recipe file."
(let* ((new-props (el-get-auto-dependencies package))
(recipe (save-excursion (goto-char (point-min))
(read (current-buffer)))))
(loop with auto-updated = nil
(cl-loop with auto-updated = nil
for (prop newval) on new-props by #'cddr
for prop-name = (symbol-name prop)
unless (equal newval (plist-get recipe prop))

View File

@ -17,7 +17,7 @@
;; Description of packages. (Code based on `describe-function').
;;
(require 'el-get-core)
(require 'cl)
(require 'cl-lib)
(declare-function el-get-install "el-get" (package))
(declare-function el-get-remove "el-get" (package))
@ -134,7 +134,7 @@ matching REGEX with TYPE and ARGS as parameter."
(if (listp depends)
(progn
(princ "Dependencies: ")
(loop for i in depends
(cl-loop for i in depends
do (el-get-describe-princ-button
(format "`%s'" i) "`\\([^`']+\\)"
'el-get-help-describe-package i)))
@ -361,7 +361,7 @@ in el-get package menu."
'font-lock-face face)))
(when desc
(indent-to (cdr (assoc "Description" el-get-package-list-column-alist)) 1)
(let ((eol (position ?\n desc)))
(let ((eol (cl-position ?\n desc)))
(when eol (setq desc (substring desc 0 eol))))
(insert (propertize desc 'font-lock-face face) "\n"))))

View File

@ -11,6 +11,8 @@
;;
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(unless (version< emacs-version "24.4")
(require 'subr-x))
@ -42,7 +44,7 @@ following are true:
- PACKAGE definition has a non-empty :checksum"
(unless el-get-allow-insecure
(assert (stringp url) nil "URL is nil, can't decide if it's safe to install package '%s'" package)
(cl-assert (stringp url) nil "URL is nil, can't decide if it's safe to install package '%s'" package)
(let* ((checksum (plist-get (el-get-package-def package) :checksum))
(checksum-empty (or (not (stringp checksum))
(if (fboundp 'string-blank-p)

View File

@ -23,6 +23,7 @@
;;; Code:
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-custom)
(require 'el-get-byte-compile)
@ -85,7 +86,7 @@ compiled version."
"Return the elements of `el-get-recipe-path' that actually exist.
Used to avoid errors when exploring the path for recipes"
(reduce (lambda (dir result)
(cl-reduce (lambda (dir result)
(if (file-directory-p dir) (cons dir result) result))
el-get-recipe-path :from-end t :initial-value nil))
@ -105,7 +106,7 @@ Used to avoid errors when exploring the path for recipes"
(insert "(")
;; Standard Emacs pretty print functions don't put newlines after
;; prop val pairs of plists, so we have to do it ourselves.
(loop for (prop val) on source by #'cddr
(cl-loop for (prop val) on source by #'cddr
do (insert (format "%S %S\n" prop val)))
(delete-char -1) ; delete last \n
(insert ")\n")
@ -125,7 +126,7 @@ Used to avoid errors when exploring the path for recipes"
"Return the name of the file that contains the recipe for PACKAGE, if any."
(let ((package-el (concat (el-get-as-string package) ".el"))
(package-rcp (concat (el-get-as-string package) ".rcp")))
(loop for dir in el-get-recipe-path
(cl-loop for dir in el-get-recipe-path
for recipe-el = (expand-file-name package-el dir)
for recipe-rcp = (expand-file-name package-rcp dir)
if (file-exists-p recipe-el) return recipe-el
@ -142,7 +143,7 @@ Used to avoid errors when exploring the path for recipes"
"Return the list of all file based recipe names.
The result may have duplicates."
(loop for dir in (el-get-recipe-dirs)
(cl-loop for dir in (el-get-recipe-dirs)
nconc (mapcar #'file-name-base
(directory-files dir nil "^[^.].*\.\\(rcp\\|el\\)$"))))
@ -153,9 +154,9 @@ Only consider any given recipe only once even if present in
multiple dirs from `el-get-recipe-path'. The first recipe found
is the one considered."
(let (packages)
(loop
(cl-loop
for dir in (el-get-recipe-dirs)
nconc (loop
nconc (cl-loop
for recipe in (directory-files dir nil "^[^.].*\.\\(rcp\\|el\\)$")
for filename = (concat (file-name-as-directory dir) recipe)
for pname = (file-name-sans-extension
@ -190,7 +191,7 @@ If R2 has a `:type' it completely replaces R1, otherwise, R1
fields are the default value and R2 may override them."
(if (plist-get r2 :type)
r2
(loop with merged
(cl-loop with merged
for (prop val) on (append r2 r1) by 'cddr
unless (plist-member merged prop)
nconc (list prop val) into merged
@ -198,7 +199,7 @@ fields are the default value and R2 may override them."
(defun el-get-package-def (package)
"Return a single `el-get-sources' entry for PACKAGE."
(let ((source (loop for src in el-get-sources
(let ((source (cl-loop for src in el-get-sources
when (string= package (el-get-source-name src))
return src)))
@ -239,7 +240,7 @@ Only consider packages whose status is `member' of STATUSES,
which defaults to installed, required and removed. Example:
(el-get-package-types-alist \"installed\" 'http 'cvs)"
(loop for src in (apply 'el-get-list-package-names-with-status
(cl-loop for src in (apply 'el-get-list-package-names-with-status
(cond ((stringp statuses) (list statuses))
((null statuses) '("installed" "required"
"removed"))
@ -293,7 +294,7 @@ of numbers, which will be returned unmodified."
(list version))
;; List of numbers
((and (listp version)
(null (remove-if 'numberp version)))
(null (cl-remove-if 'numberp version)))
version)
(t (error "Unrecognized version specification: %S" version))))
@ -320,7 +321,7 @@ Use this to modify environment variable such as $PATH or $PYTHONPATH."
"Return \"HEAD:PATHS\" omitting duplicates in it."
(let ((pplist (split-string (or paths "") path-separator 'omit-nulls)))
(mapconcat 'identity
(remove-duplicates (cons head pplist)
(cl-remove-duplicates (cons head pplist)
:test #'string= :from-end t)
path-separator)))

View File

@ -19,7 +19,7 @@
;; miserably.
;;
(require 'cl)
(require 'cl-lib)
(require 'pp)
(require 'el-get-core)
@ -76,7 +76,7 @@
(lambda (p1 p2)
(string< (el-get-as-string (car p1))
(el-get-as-string (car p2)))))))
(assert (listp recipe) nil
(cl-assert (listp recipe) nil
"Recipe must be a list")
(with-temp-file el-get-status-file
(insert (el-get-print-to-string new-package-status-alist 'pretty)))
@ -105,7 +105,7 @@
(with-temp-file (format "%s.old" el-get-status-file)
(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 old-status-list by 'cddr
(cl-loop for (p s) on old-status-list by 'cddr
for psym = (el-get-package-symbol p)
when psym
collect
@ -150,7 +150,7 @@
;;
;; a package with status "installed" and a missing directory is
;; automatically reset to "required" so that a proper install happens.
(loop for (p . prop) in p-s
(cl-loop for (p . prop) in p-s
if (and (string= (plist-get prop 'status) "installed")
(not (file-directory-p (el-get-package-directory p))))
collect (cons p (plist-put prop 'status "required"))
@ -159,12 +159,12 @@
(defun el-get-package-status-alist ()
"return an alist of (PACKAGE . STATUS)"
(loop for (p . prop) in (el-get-read-status-file)
(cl-loop for (p . prop) in (el-get-read-status-file)
collect (cons p (plist-get prop 'status))))
(defun el-get-package-status-recipes ()
"return the list of recipes stored in the status file"
(loop for (p . prop) in (el-get-read-status-file)
(cl-loop for (p . prop) in (el-get-read-status-file)
when (string= (plist-get prop 'status) "installed")
collect (plist-get prop 'recipe)))
@ -182,7 +182,7 @@
(defun el-get-filter-package-alist-with-status (package-status-alist &rest statuses)
"Return package names that are currently in given status"
(loop for (p . prop) in package-status-alist
(cl-loop for (p . prop) in package-status-alist
for s = (plist-get prop 'status)
when (member s statuses)
collect (el-get-as-string p)))
@ -204,7 +204,7 @@
(defun el-get-count-packages-with-status (packages &rest statuses)
"Return how many packages are currently in given status in PACKAGES"
(length (intersection
(length (cl-intersection
(mapcar #'el-get-as-symbol (apply #'el-get-list-package-names-with-status statuses))
(mapcar #'el-get-as-symbol packages))))
@ -212,11 +212,11 @@
"Return installed or required packages that are not in given package list"
(let ((packages
;; &rest could contain both symbols and lists
(loop for p in packages
(cl-loop for p in packages
when (listp p) append (mapcar 'el-get-as-symbol p)
else collect (el-get-as-symbol p))))
(when packages
(loop for (p . prop) in (el-get-read-status-file)
(cl-loop for (p . prop) in (el-get-read-status-file)
for s = (plist-get prop 'status)
for x = (el-get-package-symbol p)
unless (member x packages)
@ -266,7 +266,7 @@ that recipe in the el-get status file.")
Partition the properties of NEWPROPS whose value is different
from SOURCE into 3 sublists, (INIT UPDATE REINSTALL), according
to the operation required."
(loop with init and update and reinstall
(cl-loop with init and update and reinstall
with type = (let ((old-type (el-get-package-method source))
(new-type (el-get-package-method newprops)))
(if (eq old-type new-type) old-type nil))
@ -359,7 +359,7 @@ t', this error is suppressed (but nothing is updated).
(el-get-read-cached-recipe package source)))
(unless (el-get-package-is-installed package)
(error "Package %s is not installed. Cannot update recipe." package))
(destructuring-bind (required-ops added removed)
(cl-destructuring-bind (required-ops added removed)
(el-get-diagnosis-properties cached-recipe source)
(if (and required-ops (not (memq operation required-ops)))
;; Emit a verbose message if `noerror' is t (but still quit

View File

@ -179,6 +179,7 @@
;;; Code:
(require 'cl-lib)
(require 'el-get-core) ; core facilities used everywhere
(require 'el-get-custom) ; user tweaks and `el-get-sources'
(require 'el-get-methods) ; support for `el-get-methods', backends
@ -246,7 +247,7 @@ Completions are offered from all known package names, after
removing any packages in FILTERED."
(let ((packages (el-get-read-all-recipe-names)))
(completing-read (format "%s package: " action)
(set-difference packages filtered :test 'string=) nil t)))
(cl-set-difference packages filtered :test 'string=) nil t)))
(defun el-get-read-recipe-name (action)
"Ask user for a recipe name, with completion from the list of known recipe files.
@ -311,7 +312,7 @@ which defaults to the first element in `el-get-recipe-path'."
;; Convert it to a quoted call to that function
(prog1 `(,form)
(if (and (listp form)
(equal (subseq form 0 2) '(lambda ())))
(equal (cl-subseq form 0 2) '(lambda ())))
;; It's a zero-arg function, so it can be trivially
;; rewritten as a progn. Inform the user of such.
(warn "The :%s form for package %s uses the old-style lambda form instead of a lisp form. The leading \"(lambda ()\" should be replaced with \"(progn\"."
@ -326,7 +327,7 @@ which defaults to the first element in `el-get-recipe-path'."
(t (error "Unknown :%s form for package %s: `%S'"
fname package form)))))
(when form
(assert (listp form))
(cl-assert (listp form))
(el-get-verbose-message "el-get: Evaluating :%s form for package %s"
fname package)
;; don't forget to make some variables available
@ -352,7 +353,7 @@ which defaults to the first element in `el-get-recipe-path'."
(el-get-verbose-message "el-get-init: %s" package)
(let* ((init-deps (el-get-dependencies (el-get-as-symbol package))))
(el-get-verbose-message "el-get-init: " init-deps)
(loop for p in init-deps do (el-get-do-init p) collect p)))
(cl-loop for p in init-deps do (el-get-do-init p) collect p)))
(defun el-get-do-init (package &optional package-status-alist)
"Make the named PACKAGE available for use.
@ -593,7 +594,7 @@ PACKAGE may be either a string or the corresponding symbol."
(package-features (el-get-package-features pdir))
(package-files (el-get-package-files pdir))
(other-features
(remove-if (lambda (x) (memq x package-features)) all-features)))
(cl-remove-if (lambda (x) (memq x package-features)) all-features)))
(unwind-protect
(progn
;; We cannot let-bind `features' here, becauses the changes
@ -601,7 +602,7 @@ PACKAGE may be either a string or the corresponding symbol."
(setq features other-features)
;; Reload all loaded files in package dir if they still
;; exist.
(loop for file in package-files
(cl-loop for file in package-files
;; We convert errors to warnings here, because some
;; files don't like being loaded more than once in a
;; session. Example: "cedet-remove-builtin.el" from
@ -616,7 +617,7 @@ PACKAGE may be either a string or the corresponding symbol."
;; that autoloaded packages (which normally don't load
;; anything until one of their entry points is called) are
;; forced to reload immediately if they were already loaded.
(loop for f in package-features
(cl-loop for f in package-features
do (require f nil 'noerror)))
;; We have to add all the removed features back in no matter
;; what, or else we would be lying about what has been loaded.
@ -624,7 +625,7 @@ PACKAGE may be either a string or the corresponding symbol."
;; longer provides a certain feature. Technically that feature
;; is still provided, so not adding it back would be wrong.
(let ((missing-features
(remove-if (lambda (x) (memq x features)) package-features)))
(cl-remove-if (lambda (x) (memq x features)) package-features)))
(when missing-features
(warn "Adding %S back onto features, because the reloaded package did not provide them."
missing-features)
@ -667,14 +668,14 @@ different install methods."
(defun el-get-do-update (package)
"Update "
(el-get-error-unless-package-p package)
(assert (el-get-package-is-installed package) nil
(cl-assert (el-get-package-is-installed package) nil
"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))
(update (el-get-method method :update))
(url (plist-get source :url)))
(assert (null (remove-if 'el-get-package-is-installed
(cl-assert (null (cl-remove-if 'el-get-package-is-installed
(el-get-dependencies package)))
nil
"Dependencies of package %s should already be installed before updating"
@ -700,7 +701,7 @@ itself.")
(if (el-get-update-requires-reinstall package)
(el-get-reinstall package)
(let* ((package (el-get-as-symbol package))
(new-dependencies (remove-if 'el-get-package-is-installed
(new-dependencies (cl-remove-if 'el-get-package-is-installed
(el-get-dependencies package)))
(source (el-get-package-def package)))
(if (plist-get source :checksum)
@ -852,7 +853,7 @@ explicitly declared in the user-init-file (.emacs)."
(let* ((packages-to-keep (el-get-dependencies
(mapcar 'el-get-as-symbol
(add-to-list 'packages 'el-get))))
(packages-to-remove (set-difference
(packages-to-remove (cl-set-difference
(mapcar 'el-get-as-symbol
(el-get-list-package-names-with-status
"installed")) packages-to-keep)))
@ -886,7 +887,7 @@ explicitly declared in the user-init-file (.emacs)."
entry which is not a symbol and is not already a known recipe."
(interactive "Dsave recipes in directory: ")
(let* ((all (el-get-read-all-recipe-names))
(new (loop for r in el-get-sources
(new (cl-loop for r in el-get-sources
when (and (not (symbolp r))
(not (member (el-get-source-name r) all)))
collect r)))
@ -935,16 +936,16 @@ considered \"required\"."
(required (el-get-filter-package-alist-with-status p-s-alist "required"))
(installed (el-get-filter-package-alist-with-status p-s-alist "installed"))
(to-init (if packages
(loop for p in packages
(cl-loop for p in packages
when (member (el-get-as-string p) installed)
collect p)
(mapcar 'el-get-as-symbol installed)))
(init-deps (el-get-dependencies to-init))
(req-inits (loop for p in init-deps
(req-inits (cl-loop for p in init-deps
unless (member (el-get-as-string p) installed)
collect p))
(to-install (if packages
(loop for p in packages
(cl-loop for p in packages
unless (member p init-deps)
collect p)
(mapcar 'el-get-as-symbol required)))
@ -952,16 +953,16 @@ considered \"required\"."
done)
(when req-inits ; we can't init a pkg unless it's installed!
(setq install-deps (append req-inits install-deps))
(setq init-deps (set-difference init-deps req-inits)))
(setq init-deps (cl-set-difference init-deps req-inits)))
(el-get-verbose-message "el-get-init-and-install: install %S" install-deps)
(el-get-verbose-message "el-get-init-and-install: init %S" init-deps)
(loop for p in install-deps
(cl-loop for p in install-deps
when (el-get-with-errors-as-warnings (format "while installing %s: " p)
(el-get-do-install p))
collect p into done)
(loop for p in init-deps
(cl-loop for p in init-deps
when (el-get-with-errors-as-warnings (format "while initializing %s: " p)
(el-get-do-init p))
collect p into done)
@ -998,7 +999,7 @@ already installed packages is considered."
(let* ((packages
;; (el-get 'sync 'a 'b my-package-list)
(loop for p in packages when (listp p) append p else collect p))
(cl-loop for p in packages when (listp p) append p else collect p))
(el-get-default-process-sync sync))
;; load autoloads before package init so :after blocks can use the

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-recipes)
(require 'package nil t)
@ -92,12 +93,12 @@ PACKAGE isn't currently installed by ELPA."
(pregex (concat "\\`" (regexp-quote pname) "-"))
(version-offset (+ (length pname) 1)))
(catch 'dir
(loop for pkg-base-dir in (cons package-user-dir
(cl-loop for pkg-base-dir in (cons package-user-dir
(when (boundp 'package-directory-list)
package-directory-list))
when (file-directory-p pkg-base-dir)
do
(loop for pkg-dir in (directory-files pkg-base-dir nil pregex)
(cl-loop for pkg-dir in (directory-files pkg-base-dir nil pregex)
if (ignore-errors
(version-to-list (substring pkg-dir version-offset)))
do (throw 'dir (expand-file-name pkg-dir pkg-base-dir))))
@ -206,7 +207,7 @@ the recipe, then return nil."
(defun el-get-elpa-update-available-p (package)
"Returns t if PACKAGE has an update available in ELPA."
(assert (el-get-package-is-installed package) nil
(cl-assert (el-get-package-is-installed package) nil
(format "Cannot update non-installed ELPA package %s" package))
(let* ((installed-version
(package-desc-version (car (el-get-elpa-descs (assq package package-alist)))))
@ -215,7 +216,7 @@ the recipe, then return nil."
;; Emacs 24.4 keeps lists of available packages. `package-alist'
;; is sorted by version, but `package-archive-contents' is not, so
;; we should loop through it.
(some (lambda (pkg)
(cl-some (lambda (pkg)
(version-list-< installed-version
(package-desc-version pkg)))
available-packages)))

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-recipes)
(require 'el-get-git)
@ -19,7 +20,7 @@
(defun el-get-emacsmirror-get-github-source (package)
"Return a github-type source equivalent to emacsmirror PACKAGE."
(assert (equal (el-get-package-type package) 'emacsmirror) nil
(cl-assert (equal (el-get-package-type package) 'emacsmirror) nil
"Need an emacsmirror package")
(append `(:type github
:pkgname ,(format "emacsmirror/%s" package))

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-recipes)
(require 'el-get-notify)
(require 'el-get-http)
@ -73,7 +74,7 @@ filename.el ;;; filename.el --- description"
(buffer-substring (point) (line-end-position))))
(re-search-forward "^$" nil 'move)
(forward-char)
(loop
(cl-loop
with wiki-regexp =
(concat "^\\([^[:space:]]+\\.el\\)" ; filename
"\\(?:" ; optional separators
@ -98,7 +99,7 @@ into a local recipe file set"
el-get-recipe-path-emacswiki))
(coding-system-for-write 'utf-8))
(unless (file-directory-p target-dir) (make-directory target-dir 'recursive))
(loop
(cl-loop
with wiki-list = (el-get-emacswiki-retrieve-package-list)
with progress = (make-progress-reporter "Generating Emacswiki recipes"
0 (length wiki-list))

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-custom)
@ -131,9 +132,9 @@ checkout of the repository using this command."
;; Fix multi-line comment output to be a single string
(replace-regexp-in-string "\n +" " " (buffer-string))
"\n" t)))
(assert (= error 0) nil
(cl-assert (= error 0) nil
"Package %s is not a fossil package" package)
(loop for x in fossil-info
(cl-loop for x in fossil-info
collect (split-string x ": +")))))
(defun el-get-fossil-compute-checksum (package)

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-recipes)
@ -204,7 +205,7 @@ not return 'smart' headers despite supporting shallow clones"
;; type. Instead, we check for the existence of a ".git" directory
;; in the package directory. A better approach might be to call
;; "git status" and check that it returns success.
(assert (file-directory-p ".git") nil
(cl-assert (file-directory-p ".git") nil
"Package %s is not a git package" package)
(with-temp-buffer
(call-process (el-get-executable-find "git") nil '(t t) nil

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-core)
(require 'el-get-git)
@ -51,10 +52,10 @@ FROM is a literal string, not a regexp."
(error ":pkgname \"username/reponame\" is mandatory for github recipe '%s"
package)))
(user-and-repo (split-string user-slash-repo "/" 'omit-nulls)))
(assert (= (length user-and-repo) 2) nil
(cl-assert (= (length user-and-repo) 2) nil
"Github pkgname %s must be of the form username/reponame"
user-slash-repo)
(cons (first user-and-repo) (second user-and-repo))))
(cons (cl-first user-and-repo) (cl-second user-and-repo))))
(defun el-get-github-url-private (url-type username reponame)
"Return the url of a particular github project.

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-http)
(defun el-get-http-unpack-cleanup-extract-hook (package)
@ -26,7 +27,7 @@
;; if there's only one directory, move its content up and get rid of it
(when (and (not (cdr files))
(file-directory-p (expand-file-name dir pdir)))
(loop for fname in (directory-files
(cl-loop for fname in (directory-files
(expand-file-name dir pdir) nil "[^.]$")
for fullname = (expand-file-name fname (expand-file-name dir pdir))
for newname = (expand-file-name fname pdir)
@ -50,7 +51,7 @@
;; Remove all files from previous install before
;; extracting the tar file.
(let ((files-to-delete (remove ,tarfile (directory-files ,pdir nil "[^.]$"))))
(loop for fname in files-to-delete
(cl-loop for fname in files-to-delete
for fullpath = (expand-file-name fname ,pdir)
do (el-get-verbose-message "el-get-http-tar: Deleting old file %S" fname)
do (if (file-directory-p fullpath)

View File

@ -12,6 +12,7 @@
;; Install
;; Please see the README.md file from the same distribution
(require 'cl-lib)
(require 'el-get-http)
(require 'el-get-http-tar)
@ -29,7 +30,7 @@
;; Remove all files from previous install before
;; extracting the tar file.
(let ((files-to-delete (remove ,zipfile (directory-files ,pdir nil "[^.]$"))))
(loop for fname in files-to-delete
(cl-loop for fname in files-to-delete
for fullpath = (expand-file-name fname ,pdir)
do (el-get-verbose-message "el-get-http-tar: Deleting old file %S" fname)
do (if (file-directory-p fullpath)

View File

@ -1,6 +1,6 @@
;; Benchmark for caching the package status alist
(require 'cl)
(require 'cl-lib)
(defmacro timeit (&rest body)
"Run body and report real time taken to do so."
@ -14,7 +14,7 @@
(defmacro suppress-messages (&rest body)
"Run body with `message' redefined as a no-op."
`(flet ((message (&rest ignored) nil))
`(cl-flet ((message (&rest ignored) nil))
(progn ,@body)))
(put 'suppress-messages 'lisp-indent-function
(get 'progn 'lisp-indent-function))
@ -37,7 +37,7 @@
(message "Beginning benchmark")
;; Repeat benchmark 5 times to see consistency
(let ((times
(loop
(cl-loop
for rep from 1 upto 5
collect
(timeit

View File

@ -2,9 +2,9 @@
(require 'ert nil t)
(eval-when-compile
(require 'cl)
(require 'cl-lib)
(unless (featurep 'ert)
(defmacro* ert-deftest (name () &body docstring-keys-and-body)
(cl-defmacro ert-deftest (name () &body docstring-keys-and-body)
(message "Skipping tests, ERT is not available"))))
(defvar el-get-test-output-buffer nil)
@ -76,7 +76,7 @@ Following variables are bound to temporal values:
(while (file-exists-p f)
(setq f (concat f f))) f))))
(should (equal (el-get-recipe-dirs)
(loop for f in el-get-recipe-path
(cl-loop for f in el-get-recipe-path
when (file-exists-p f)
collect f)))))
@ -221,7 +221,7 @@ John.Doe-123_@example.com"))
(let* ((github-pkgname "user/dummy.el")
(el-get-sources `((:name "dummy" :type github :pkgname ,github-pkgname)))
(el-get-allow-insecure nil))
(letf (((symbol-function 'el-get-package-is-installed)
(cl-letf (((symbol-function 'el-get-package-is-installed)
(lambda (package)
(string= package "dummy")))
((symbol-function 'el-get-git-pull)

View File

@ -1,5 +1,6 @@
(require 'debug)
(require 'el-get)
(require 'cl)
(setq debugger-batch-max-lines (+ 50 max-lisp-eval-depth)
debug-on-error t
el-get-verbose t