summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-03-04 02:07:41 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-03-04 02:07:41 +0100
commit708205e21031dd016172523ef15e9aeda4417412 (patch)
tree5671a36110621612599b2578d3e3159cd7ad92c9
parent1561d097a65189175d43b5960a93cac194f4a2f4 (diff)
downloadgeiser-708205e21031dd016172523ef15e9aeda4417412.tar.gz
geiser-708205e21031dd016172523ef15e9aeda4417412.tar.bz2
New geiser-reload command. New geiser command.
-rw-r--r--README2
-rw-r--r--elisp/geiser-debug.el1
-rw-r--r--elisp/geiser-mode.el11
-rw-r--r--elisp/geiser-repl.el18
-rw-r--r--elisp/geiser.el64
5 files changed, 93 insertions, 3 deletions
diff --git a/README b/README
index 0300dfa..98ddf77 100644
--- a/README
+++ b/README
@@ -13,6 +13,8 @@
In particular, customize `geiser-repl-guile-binary' (in
geiser-repl), which should point to a guile-vm executable.
+ - To start a REPL, M-x geiser.
+
* Quick key reference
*** In Scheme buffers:
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