Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 537ff524 authored by Ryan C. Thompson's avatar Ryan C. Thompson

Add function el-get-plist-get-with-default

It encapsulates the following common pattern, used several times in
el-get to allow recipe properties to override defaults if present:

(if (plist-member plist prop)
    (plist-get plist prop)
parent c9944fda
......@@ -335,7 +335,7 @@ makes it easier to conditionally splice a command into the list.
(args (if shell
(mapcar #'shell-quote-argument (plist-get c :args))
(plist-get c :args)))
(sync (if (plist-member c :sync) (plist-get c :sync)
(sync (el-get-plist-get-with-default c :sync
(stdin (plist-get c :stdin))
(default-directory (if cdir
......@@ -430,4 +430,16 @@ out if it's nil."
(defun el-get-plist-get-with-default (plist prop def)
"Same as (plist-get PLIST PROP), but falls back to DEF.
Specifically, if (plist-member PLIST PROP) is nil, then returns
DEF instead. Note that having a property set to nil is not the
same as having it unset."
(if (plist-member plist prop)
(plist-get plist prop)
(put 'el-get-plist-get-with-default 'lisp-indent-function
(get 'prog2 'lisp-indent-function))
(provide 'el-get-core)
......@@ -51,9 +51,8 @@ found."
(not submodule-prop)))
(checkout (or (plist-get source :checkout)
(plist-get source :checksum)))
(shallow (if (plist-member source :shallow)
(plist-get source :shallow)
(shallow (el-get-plist-get-with-default source :shallow
(clone-args (append '("--no-pager" "clone")
(when shallow '("--depth" "1"))
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