summary refs log tree commit diff stats
path: root/lisp/yoke.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/yoke.el')
-rw-r--r--lisp/yoke.el111
1 files changed, 57 insertions, 54 deletions
diff --git a/lisp/yoke.el b/lisp/yoke.el index f9c4d49..8ca94fd 100644 --- a/lisp/yoke.el +++ b/lisp/yoke.el
@@ -84,60 +84,63 @@ Execute BODY afterward.
84 append (list this next) into ret 84 append (list this next) into ret
85 finally return (cond ((eq (car (last ret)) nil) 85 finally return (cond ((eq (car (last ret)) nil)
86 (butlast ret)) 86 (butlast ret))
87 (:else ret))))) 87 (:else ret))))
88 `(cl-block ,pname 88 (r (gensym)))
89 (condition-case err 89 `(let ((,r (cl-block ,pname
90 (progn 90(condition-case err
91 ;; Pass `:when' or `:unless' clauses 91 (progn
92 ,@(cond 92 ;; Pass `:when' or `:unless' clauses
93 ((and whenp unlessp) 93 ,@(cond
94 `((when (or (not ,when) ,unless) 94 ((and whenp unlessp)
95 (cl-return-from ,pname 95 `((when (or (not ,when) ,unless)
96 (format "%s (abort) :when %S :unless %S" 96 (cl-return-from ,pname
97 ',pname ',when ',unless))))) 97 (format "%s (abort) :when %S :unless %S"
98 (whenp 98 ',pname ',when ',unless)))))
99 `((unless ,when (cl-return-from ,pname 99 (whenp
100 (format "%s (abort) :when %S" 100 `((unless ,when (cl-return-from ,pname
101 ',pname ',when))))) 101 (format "%s (abort) :when %S"
102 (unlessp 102 ',pname ',when)))))
103 `((when ,unless (cl-return-from ,pname 103 (unlessp
104 (format "%s (abort) :unless %S" 104 `((when ,unless (cl-return-from ,pname
105 ',pname ',unless)))))) 105 (format "%s (abort) :unless %S"
106 ;; Evaluate `:pre' forms 106 ',pname ',unless))))))
107 ,@pre 107 ;; Evaluate `:pre' forms
108 ;; Get prerequisite packages 108 ,@pre
109 ,@(cl-loop 109 ;; Get prerequisite packages
110 for (pkg* . yoke-get-args) in depends 110 ,@(cl-loop
111 collect `(or 111 for (pkg* . yoke-get-args) in depends
112 (let* ((pkg-spec (yoke-get ,@yoke-get-args 112 collect `(or
113 :dir ,(format "%s" pkg*))) 113 (let* ((pkg-spec (yoke-get ,@yoke-get-args
114 (dir (expand-file-name (or (plist-get (cdr pkg-spec) :load) 114 :dir ,(format "%s" pkg*)))
115 "") 115 (dir (expand-file-name (or (plist-get (cdr pkg-spec) :load)
116 (car pkg-spec)))) 116 "")
117 (and dir 117 (car pkg-spec))))
118 ,@(if autoload 118 (and dir
119 `((yoke-generate-autoloads ',pkg* dir)) 119 ,@(if autoload
120 '(t)) 120 `((yoke-generate-autoloads ',pkg* dir))
121 (add-to-list 'yoke-dirs dir nil #'string=))) 121 '(t))
122 (cl-return-from ,pname 122 (add-to-list 'yoke-dirs dir nil #'string=)))
123 (format "Error fetching prerequiste: %s" 123 (cl-return-from ,pname
124 ',pkg*)))) 124 (format "Error fetching prerequiste: %s"
125 ;; Download the package, generate autoloads 125 ',pkg*))))
126 ,@(when url 126 ;; Download the package, generate autoloads
127 `((let* ((pkg-spec (yoke-get ,@url :dir ,(format "%s" pkg))) 127 ,@(when url
128 (,dirvar (expand-file-name (or (plist-get (cdr pkg-spec) :load) 128 `((let* ((pkg-spec (yoke-get ,@url :dir ,(format "%s" pkg)))
129 "") 129 (,dirvar (expand-file-name (or (plist-get (cdr pkg-spec) :load)
130 (car pkg-spec)))) 130 "")
131 ,@(when autoload 131 (car pkg-spec))))
132 `((yoke-generate-autoloads ',pkg ,dirvar))) 132 ,@(when autoload
133 (add-to-list 'yoke-dirs ,dirvar nil #'string=)))) 133 `((yoke-generate-autoloads ',pkg ,dirvar)))
134 ;; Evaluate the body, optionally after the features in `:after' 134 (add-to-list 'yoke-dirs ,dirvar nil #'string=))))
135 ,@(cond (after 135 ;; Evaluate the body, optionally after the features in `:after'
136 `((yoke-eval-after ,after ,@body))) 136 ,@(cond (after
137 (:else body))) 137 `((yoke-eval-after ,after ,@body)))
138 (:success ',package) 138 (:else body)))
139 (t (message "%s: %s (%s)" ',pname (car err) (cdr err)) 139 (:success ',package)
140 nil))))) 140 (t (message "%s: %s (%s)" ',pname (car err) (cdr err))
141 nil)))))
142 (when (stringp ,r) (message "%S" ,r))
143 ,r)))
141 144
142(defun yoke-get (url &rest args) 145(defun yoke-get (url &rest args)
143 "\"Get\" URL and and put it in DIR, then add DIR to `load-path'. 146 "\"Get\" URL and and put it in DIR, then add DIR to `load-path'.