diff options
| author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-11-08 05:44:18 +0100 | 
|---|---|---|
| committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-11-08 05:44:18 +0100 | 
| commit | 06ade45ac52d5597dc04655f4668b02f9b3ebdf2 (patch) | |
| tree | 2aada157405ca5127221ab18280a1b33c35b3baf | |
| parent | 92066980e04a39a65cca1966b56b11ed78362744 (diff) | |
| download | geiser-06ade45ac52d5597dc04655f4668b02f9b3ebdf2.tar.gz geiser-06ade45ac52d5597dc04655f4668b02f9b3ebdf2.tar.bz2  | |
geiser-squarify to toggle between () and []
| -rw-r--r-- | README | 1 | ||||
| -rw-r--r-- | doc/cheat.texi | 3 | ||||
| -rw-r--r-- | doc/parens.texi | 4 | ||||
| -rw-r--r-- | elisp/geiser-mode.el | 19 | 
4 files changed, 27 insertions, 0 deletions
@@ -111,6 +111,7 @@      | M-.                 | Go to definition of identifier at point         |      | M-,                 | Go back to where M-. was last invoked           |      | C-c C-e m           | Ask for a module and open its file              | +    | C-c C-e [           | Toggle between () and [] for current form       |      |---------------------+-------------------------------------------------|      | C-M-x               | Eval definition around point                    |      | C-c M-e             | Eval definition around point and switch to REPL | diff --git a/doc/cheat.texi b/doc/cheat.texi index adcc4d8..4e81b92 100644 --- a/doc/cheat.texi +++ b/doc/cheat.texi @@ -31,6 +31,9 @@  @item C-c C-e C-m  @tab geiser-edit-module  @tab Ask for a module and open its file +@item C-c C-e C-[ +@tab geiser-squarify +@tab Toggle between () and [] for current form  @item @tab @tab  @item C-M-x  @tab geiser-eval-definition diff --git a/doc/parens.texi b/doc/parens.texi index 9ce0d05..9839892 100644 --- a/doc/parens.texi +++ b/doc/parens.texi @@ -482,6 +482,10 @@ try to find a module name that matches it. You can also request  explicitly completion only over module names using @kbd{M-`} (that's a  backtick). +There's also this little command, @code{geiser-squarify}, which will +toggle the delimiters of the innermost list around point between round +and square brackets. It is bound to @key{C-c C-e [}. +  @c Local Variables:  @c mode: texinfo  @c TeX-master: "geiser" 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)))  | 
