1 ;; geiser-reload.el -- unload/load geiser packages
3 ;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
5 ;; This program is free software; you can redistribute it and/or
6 ;; modify it under the terms of the Modified BSD License. You should
7 ;; have received a copy of the license along with this program. If
8 ;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>.
10 ;; Start date: Sat Aug 22, 2009 23:04
14 (require 'geiser-impl
)
15 (require 'geiser-repl
)
16 (require 'geiser-mode
)
17 (require 'geiser-custom
)
18 (require 'geiser-base
)
24 (defmacro geiser--features-list
()
49 (defun geiser-unload ()
50 "Unload all Geiser modules."
52 (let ((fs (geiser--features-list)))
53 (unload-feature 'geiser-reload t
)
55 (when (featurep f
) (unload-feature f t
)))))
57 (defun geiser-reload (&optional arg
)
59 With prefix arg, prompts for the DIRECTORY from which Geiser should be
62 (let* ((old-dir geiser-elisp-dir
)
63 (dir (or (and arg
(read-directory-name "New Geiser elisp dir: "
64 old-dir old-dir t old-dir
))
66 (unless (or (file-exists-p (expand-file-name "geiser-reload.el" dir
))
67 (file-exists-p (expand-file-name "geiser-reload.elc" dir
)))
68 (error "%s does not contain Geiser!" dir
))
69 (let ((installed (featurep 'geiser-install
))
70 (memo (geiser-custom--memoized-state))
71 (impls geiser-impl--impls
)
72 (repls (geiser-repl--repl-list))
73 (buffers (geiser-mode--buffers)))
75 (setq load-path
(remove old-dir load-path
))
76 (add-to-list 'load-path dir
)
77 (mapc (lambda (x) (set (car x
) (cdr x
))) memo
)
78 (require 'geiser-reload
)
79 (when installed
(require 'geiser-install nil t
))
80 (geiser-impl--reload-implementations impls
)
81 (geiser-repl--restore repls
)
82 (geiser-mode--restore buffers
)
83 (message "Geiser reloaded!"))))
86 (provide 'geiser-reload
)
87 ;;; geiser-reload.el ends here