summaryrefslogtreecommitdiff
path: root/elisp/geiser-racket.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2013-08-25 07:12:07 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2013-08-25 07:12:07 +0200
commit3a1dbf4e37f44e853cb649805a1f8777d0ba7501 (patch)
tree9bc66cfe6a9efd1040fa3793a004d7fc610d81fe /elisp/geiser-racket.el
parent79d3a9a2f332f71711734ee5dd1b7fb2c45ca797 (diff)
downloadgeiser-guile-3a1dbf4e37f44e853cb649805a1f8777d0ba7501.tar.gz
geiser-guile-3a1dbf4e37f44e853cb649805a1f8777d0ba7501.tar.bz2
Let's make it *any* submodule
So the new functions are named geiser-racket-*-submodules, and by default all submodule forms are hidden. Now that we have the helpers in geiser-edit, we could have a generic command in geiser-mode to change the visibility of form at point.
Diffstat (limited to 'elisp/geiser-racket.el')
-rw-r--r--elisp/geiser-racket.el50
1 files changed, 32 insertions, 18 deletions
diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el
index 9e00c4d..435fb39 100644
--- a/elisp/geiser-racket.el
+++ b/elisp/geiser-racket.el
@@ -373,24 +373,38 @@ using start-geiser, a procedure in the geiser/server module."
;;; Additional commands
-(defconst geiser-racket--test-module "module+ test")
-
-(defun geiser-racket-toggle-tests ()
- "Toggle visibility of test module fragments of the form (module+ test).
-
-When hidden, the test module forms are shown as an ellipsis."
- (interactive)
- (geiser-edit--toggle-visibility geiser-racket--test-module))
-
-(defun geiser-racket-show-tests ()
- "Unconditionally shows all test modules."
- (interactive)
- (geiser-edit--show geiser-racket--test-module))
-
-(defun geiser-racket-hide-tests ()
- "Unconditionally hides all visible test modules."
- (interactive)
- (geiser-edit--hide geiser-racket--test-module))
+(defvar geiser-racket--submodule-history ())
+
+(defun geiser-racket--submodule-form (name)
+ (format "module[+*]? %s"
+ (cond ((eq 1 name) "")
+ ((numberp name)
+ (read-string "Submodule name: " nil
+ 'geiser-racket--submodule-history))
+ ((stringp name) name)
+ t "")))
+
+(defun geiser-racket-toggle-submodules (&optional name)
+ "Toggle visibility of submodule forms.
+
+Use a prefix to be asked for a submodule name."
+ (interactive "p")
+ (geiser-edit--toggle-visibility (geiser-racket--submodule-form name)))
+
+(defun geiser-racket-show-submodules (&optional name)
+ "Unconditionally shows all submodule forms.
+
+Use a prefix to be asked for a submodule name."
+ (interactive "p")
+ (cond ((eq 1 name) (geiser-edit--show-all))
+ (t (geiser-edit--show (geiser-racket--submodule-form name)))))
+
+(defun geiser-racket-hide-submodules (&optional name)
+ "Unconditionally hides all visible submodules.
+
+Use a prefix to be asked for a submodule name."
+ (interactive "p")
+ (geiser-edit--hide (geiser-racket--submodule-form name)))
;;; Implementation definition: