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 9f0e47dd authored by Dimitri Fontaine's avatar Dimitri Fontaine

Implement fetching the elisp script list from emacswiki and maintaining a

local recipe cache out of that.  M-x el-get-emacswiki-refresh to be all
setup, then M-x el-get-install and enjoy.
parent 79867c67
\ No newline at end of file
......@@ -204,6 +204,14 @@ M-x el-get-make-recipes::
recipe files: one file for each entry in +el-get-sources+ that is not
just a +symbol+ and that is not found anywhere in +el-get-recipe-path+.
M-x el-get-emacswiki-refresh::
Will launch a subprocess that connects to EmacsWiki and fetch from there
the list of elisp scripts hosted. Then produce a recipe file per
script, and store that in the given directory, which default to
+~/.emacs.d/el-get/el-get/recipes/emacswiki/+ if you didn't change
== Internals
TODO: explain the symlinks in +~/.emacs.d/el-get+. For now, read the source
......@@ -250,8 +250,13 @@ the named package action in the given method."
(defvar el-get-dir "~/.emacs.d/el-get/"
"*Path where to install the packages.")
(defvar el-get-recipe-path-emacswiki
(concat (file-name-directory el-get-script) "recipes/emacswiki/")
"*Define where to keep a local copy of emacswiki recipes")
(defvar el-get-recipe-path
(list (concat (file-name-directory el-get-script) "recipes"))
(list (concat (file-name-directory el-get-script) "recipes")
"*Define where to look for the recipes, that's a list of directories")
(defvar el-get-status-file
......@@ -287,6 +292,14 @@ the named package action in the given method."
"*The base URL where to fetch :emacswiki packages")
(defvar el-get-emacswiki-elisp-index-url
"*The emacswiki index URL of elisp pages")
(defvar el-get-emacswiki-elisp-index-base-url
"*The emacswiki base URL used in the index")
(defvar el-get-pacman-base "/usr/share/emacs/site-lisp"
"Where to link the el-get symlink to, /<package> will get appended.")
......@@ -1351,6 +1364,57 @@ into the package :localname option or its `file-name-nondirectory' part."
(let ((url (or url (format el-get-emacswiki-base-url package))))
(el-get-http-install package url post-install-fun)))
(defun el-get-emacswiki-retrieve-package-list ()
"retrieve the package list from emacswiki"
(url-retrieve-synchronously el-get-emacswiki-elisp-index-url)
(goto-char (point-min))
(lambda (p) (string-match "el$" p))
while (re-search-forward el-get-emacswiki-elisp-index-base-url nil 'move)
collect (buffer-substring-no-properties
(point) (1- (re-search-forward "\"" nil 'move)))))))
(defun el-get-emacswiki-build-local-recipes (&optional target-dir)
"retrieve the index of elisp pages at emacswiki and turn them
into a local recipe file set"
(let ((target-dir (or target-dir
(car command-line-args-left)
(unless (file-directory-p target-dir) (make-directory target-dir))
for package in (el-get-emacswiki-retrieve-package-list)
unless (file-exists-p (expand-file-name package target-dir))
do (with-temp-file (expand-file-name package target-dir)
(message "%s" package)
(insert (format "(:name %s :type emacswiki)"
(file-name-sans-extension package)))))))
(defun el-get-emacswiki-refresh (&optional target-dir)
"run Emacs -Q in an asynchronous subprocess to get the package
list from emacswiki and build a local recipe directory out of
(list (read-directory-name "emacswiki recipes go to: "
(let* ((name "*el-get-emacswiki*")
(dummy (kill-buffer name))
(format "-Q -batch -l %s -f el-get-emacswiki-build-local-recipes %s"
(symbol-file 'el-get-emacswiki-build-local-recipes 'defun))
(apply 'start-process name name el-get-emacs (split-string args))))
(message "%s %s" el-get-emacs args)
'(lambda (proc event)
(when (eq (process-status proc) 'exit)
(el-get-notify "el-get: EmacsWiki"
"EmacsWiki local recipe list refreshed"))))))
;; http-tar support (archive)
......@@ -1787,7 +1851,7 @@ get merged to `el-get-sources'."
(when merge el-get-sources)
(loop for dir in el-get-recipe-path
nconc (loop for recipe in (directory-files dir nil "\.el$")
nconc (loop for recipe in (directory-files dir nil "^[^.].*\.el$")
for filename = (concat (file-name-as-directory dir) recipe)
and package = (file-name-sans-extension (file-name-nondirectory recipe))
unless (member package packages)
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