diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-03-04 02:07:41 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-03-04 02:07:41 +0100 |
commit | 902b7685194e9adfcd19d518a45dae3c4b13a90b (patch) | |
tree | 5558ffadf7779ec3ff8238f9ea2a8b4bef5cbf1c /elisp | |
parent | a4b7db53db0d05b8a39c263715a296d64b4f64f4 (diff) | |
download | geiser-chez-902b7685194e9adfcd19d518a45dae3c4b13a90b.tar.gz geiser-chez-902b7685194e9adfcd19d518a45dae3c4b13a90b.tar.bz2 |
New geiser-reload command. New geiser command.
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-debug.el | 1 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 11 | ||||
-rw-r--r-- | elisp/geiser-repl.el | 18 | ||||
-rw-r--r-- | elisp/geiser.el | 64 |
4 files changed, 91 insertions, 3 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el index 0bc3f85..35b81ca 100644 --- a/elisp/geiser-debug.el +++ b/elisp/geiser-debug.el @@ -25,7 +25,6 @@ ;;; Code: -(require 'geiser-repl) (require 'geiser-eval) (require 'geiser-popup) (require 'geiser-base) diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index 6a3df40..855f071 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -193,5 +193,16 @@ interacting with the Geiser REPL is at your disposal. (geiser-mode--triple-chord ?x ?x 'geiser-expand-definition) +;;; Reload support: + +(defun geiser-mode--buffers () + (let ((buffers)) + (dolist (buffer (buffer-list)) + (when (buffer-live-p buffer) + (set-buffer buffer) + (when geiser-mode (push buffer buffers)))) + buffers)) + + (provide 'geiser-mode) ;;; geiser-mode.el ends here diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index c542a66..304b0d4 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -158,9 +158,13 @@ REPL buffer." ;;; Interface: starting and interacting with geiser REPL: (defalias 'switch-to-guile 'run-guile) -(defalias 'switch-to-geiser-repl 'run-guile) -(defun run-guile (&optional arg) +(defun run-guile () + "Run Geiser using Guile." + (interactive) + (geiser 'guile)) + +(defun geiser (&optional implementation) "Show the geiser-repl buffer, starting the process if needed." (interactive) (let ((buf (process-buffer (geiser-repl--process t))) @@ -223,6 +227,16 @@ REPL buffer." (define-key geiser-repl-mode-map "\M-." 'geiser-edit-symbol-at-point) (define-key geiser-repl-mode-map "\M-," 'geiser-edit-pop-edit-symbol-stack) + +;;; Unload: + +(defun geiser-repl--live-p () + (buffer-live-p geiser-repl--buffer)) + +(defun geiser-repl-unload-function () + (when (geiser-repl--live-p) + (kill-buffer geiser-repl--buffer)) + t) (provide 'geiser-repl) diff --git a/elisp/geiser.el b/elisp/geiser.el index 3bdc218..ea41779 100644 --- a/elisp/geiser.el +++ b/elisp/geiser.el @@ -45,6 +45,9 @@ ;;; Autoloads: +(autoload 'geiser "geiser-repl.el" + "Start a Geiser REPL, or switch to a running one." t) + (autoload 'run-guile "geiser-repl.el" "Start a Geiser Guile REPL, or switch to a running one." t) @@ -70,5 +73,66 @@ (geiser-setup-scheme-mode)) +;;; Reload: + +(defmacro geiser--features-list () + (quote '( + geiser-mode + geiser-repl + geiser-doc + geiser-edit + geiser-completion + geiser-autodoc + geiser-compile + geiser-debug + geiser-eval + geiser-connection + geiser-syntax + geiser-log + geiser-custom + geiser-base + geiser-popup + ))) + +(defun geiser-unload-function () + (dolist (feature (geiser--features-list)) + (when (featurep feature) (unload-feature feature t))) + t) + +(defun geiser-unload () + (interactive) + (when (featurep 'geiser) (unload-feature 'geiser))) + +(defun geiser-reload (&optional arg) + "Reload Geiser. +With prefix arg, prompts for the DIRECTORY in which Geiser should be +loaded." + (interactive "P") + (let* ((dir (or (and arg (read-directory-name "New Geiser root dir: " + geiser-root-dir + geiser-root-dir + t + geiser-root-dir)) + geiser-root-dir)) + (geiser-main-file (expand-file-name "elisp/geiser.el" dir)) + (repl (and (featurep 'geiser-repl) (geiser-repl--live-p))) + (buffers (and (featurep 'geiser-mode) (geiser-mode--buffers)))) + (unless (file-exists-p geiser-main-file) + (error "%s does not contain Geiser!" dir)) + (remove geiser-elisp-dir load-path) + (geiser-unload) + (load-file geiser-main-file) + (geiser-setup) + (when repl + (load-library "geiser-repl") + (geiser 'repl)) + (when buffers + (load-library "geiser-mode") + (dolist (b buffers) + (set-buffer b) + (geiser-mode 1))) + (message "Geiser reloaded!"))) + + (provide 'geiser) ;;; geiser.el ends here |