forked from dimitri/el-get
-
Notifications
You must be signed in to change notification settings - Fork 0
/
el-get-issue-407.el
48 lines (43 loc) · 1.59 KB
/
el-get-issue-407.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;; https://github.com/dimitri/el-get/issues/407
;;
;; use url-retrieve-synchronously in init file
;;
;; Drop the -L . option from the README.md for this very test.
(require 'cl)
;; Unload el-get and delete it from the load path
;; Prevent errors from notifications by overriding `el-get-notify' to
;; only use `message'. This is necessary because the stable version of
;; el-get may be too old to support `el-get-notify-type'.
(eval-after-load "el-get"
'(defadvice el-get-notify (around prevent-notification-errors activate)
(message "%s: %s"
(ad-get-arg 0)
(ad-get-arg 1))))
(when (require 'el-get nil t)
;; Remove from load-path
(setq load-path
(remove-if (apply-partially
#'string-prefix-p
(expand-file-name
"."
(file-name-directory
(symbol-file 'el-get 'defun))))
load-path))
;; Unload features
(loop for feat in features
if (string-prefix-p "el-get" (symbol-name feat))
do (progn
(unload-feature feat 'force)
(assert (not (require feat nil t)) Nil
"%s should not be loadable now" feat)))
(assert (not (require 'el-get nil t)) nil
"el-get should not be loadable now"))
(unless (require 'el-get nil t)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
(end-of-buffer)
(eval-print-last-sexp))
(message "el-get is ready now"))
;; Make sure el-get is now available
(require 'el-get)