Commit ff504e2d authored by Dimitri Fontaine's avatar Dimitri Fontaine

Implement `el-get-reload' with ideas from #434.

parent 77ae4e9f
......@@ -174,6 +174,25 @@ directory or a symlink in el-get-dir."
(or (file-directory-p pdir)
(file-symlink-p pdir))))
(defun el-get-reload-alist (package &rest prefixes)
"Returns an alist of (feature . filename) for el-get packages
which uses given prefixes. For example, el-get features all begin
with 'el-get and gnus features are more spread, thus you would do
el-get-reload-alist 'gnus 'mail- 'mm- 'mess 'mml 'nn 'pgg 'sasl 'sieve 'spam
That's not the whole story for gnus but hopefully gives an idea
on how to call that function."
(loop with pdir = (el-get-package-directory package)
for (f . l) in load-history
for lib = (cdr (assoc 'provide l))
when (loop for p in (or prefixes package)
when (and (string-match (format "^%s" pdir) f)
(string-match (format "^%s" (symbol-name p))
(symbol-name lib)))
return t)
collect (cons lib f)))
;;
;; call-process-list utility
......
......@@ -58,7 +58,10 @@
(defun el-get-list-package-names-with-status (&rest status)
"Return package names that are currently in given status"
(loop for (p s) on (el-get-read-all-packages-status) by 'cddr
when (member s status) collect (el-get-package-name p)))
;; it can happen that (el-get-package-name) returns nil here and
;; that breaks the completion-read command
when (and (member s status) (el-get-package-name p))
collect (el-get-package-name p)))
(defun el-get-read-package-with-status (action &rest status)
"Read a package name in given status"
......
......@@ -547,6 +547,17 @@ PACKAGE may be either a string or the corresponding symbol."
(interactive)
(mapc 'el-get-update (el-get-list-package-names-with-status "installed")))
(defun el-get-reload (package)
"reload all the files associated with features coming from PACKAGE"
(interactive
(list (el-get-read-package-with-status "Reload" "installed")))
(loop with package = (intern package)
with prefixes = (or (plist-get (el-get-package-def package) :reload)
(list package))
for (feat . file) in (apply #'el-get-reload-alist package prefixes)
for f = (file-name-sans-extension file)
do (load f)))
(defun el-get-self-update ()
"Update el-get itself. The standard recipe takes care of reloading the code."
(interactive)
......
......@@ -8,4 +8,12 @@
:info "texi"
:load-path ("lisp")
:autoloads nil
:reload (gnus assistant binhex canlock color compface deuglify dgnus
dig dns ecomplete flow-fill format-spec gmm-
gravatar gssapi hashcash hex-util hmac- html2text
ietf-drums imap legacy-gnus lpath md4 netrc ntlm
parse-time password-cache plstore pop3 proto-stream qp
registry rfc rtree score-mode sha1 shr smiley smime
mail- mm- mess mml nn pgg sasl sieve spam starttls
time-date tls utf7 uudecode yenc)
:features gnus-load)
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