summaryrefslogtreecommitdiff
path: root/elisp/geiser-mode.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-08 05:44:18 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-08 05:44:18 +0100
commit06ade45ac52d5597dc04655f4668b02f9b3ebdf2 (patch)
tree2aada157405ca5127221ab18280a1b33c35b3baf /elisp/geiser-mode.el
parent92066980e04a39a65cca1966b56b11ed78362744 (diff)
downloadgeiser-06ade45ac52d5597dc04655f4668b02f9b3ebdf2.tar.gz
geiser-06ade45ac52d5597dc04655f4668b02f9b3ebdf2.tar.bz2
geiser-squarify to toggle between () and []
Diffstat (limited to 'elisp/geiser-mode.el')
-rw-r--r--elisp/geiser-mode.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index e9e5563..3575474 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -176,6 +176,24 @@ With prefix, try to enter the current's buffer module."
(goto-char (point-max))
(pop-to-buffer b)))
+(defun geiser-squarify ()
+ "Toggle between () and [] for current form."
+ (interactive)
+ (let ((pared (and (boundp 'paredit-mode) paredit-mode)))
+ (when pared (paredit-mode -1))
+ (unwind-protect
+ (save-excursion
+ (unless (looking-at-p "\\s(") (backward-up-list))
+ (let ((p (point))
+ (round (looking-at-p "(")))
+ (forward-sexp)
+ (backward-delete-char 1)
+ (insert (if round "]" ")"))
+ (goto-char p)
+ (delete-char 1)
+ (insert (if round "[" "("))))
+ (when pared (paredit-mode 1)))))
+
;;; Geiser mode:
@@ -258,6 +276,7 @@ interacting with the Geiser REPL is at your disposal.
("Complete module name" ((kbd "M-`") (kbd "C-."))
geiser-completion--complete-module)
("Edit module" ("\C-c\C-e\C-m" "\C-c\C-em") geiser-edit-module)
+ ("Toggle ()/[]" ("\C-c\C-e\C-[" "\C-c\C-e[") geiser-squarify)
--
("Callers" ((kbd "C-c <")) geiser-xref-callers
:enable (and (geiser-eval--supported-p 'callers) (symbol-at-point)))