Skip to content

Commit 6851394

Browse files
author
Bozhidar Batsov
committed
[Fix #682] Place the point after the expanded form when doing macroexpansion
1 parent d73683c commit 6851394

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cider-macroexpansion.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ This variable specifies both what was expanded and the expander.")
8484
(let* ((expansion (cider-macroexpansion expander (cider-last-sexp)))
8585
(bounds (cons (save-excursion (backward-sexp) (point)) (point))))
8686
(cider-redraw-macroexpansion-buffer
87-
expansion (current-buffer) (car bounds) (cdr bounds) (point))))
87+
expansion (current-buffer) (car bounds) (cdr bounds))))
8888

8989
(defun cider-macroexpand-again ()
9090
"Repeat the last macroexpansion."
@@ -128,21 +128,21 @@ If invoked with a PREFIX argument, use 'macroexpand' instead of
128128
(buffer-undo-list t))
129129
(erase-buffer)
130130
(insert (format "%s" expansion))
131-
(goto-char (point-min))
131+
(goto-char (point-max))
132132
(font-lock-fontify-buffer)))
133133

134-
(defun cider-redraw-macroexpansion-buffer (expansion buffer start end current-point)
134+
(defun cider-redraw-macroexpansion-buffer (expansion buffer start end)
135135
"Redraw the macroexpansion with new EXPANSION.
136136
Text in BUFFER from START to END is replaced with new expansion,
137-
and point is placed at CURRENT-POINT."
137+
and point is placed after the expanded form."
138138
(with-current-buffer buffer
139139
(let ((buffer-read-only nil))
140140
(goto-char start)
141141
(delete-region start end)
142142
(insert (format "%s" expansion))
143143
(goto-char start)
144144
(indent-sexp)
145-
(goto-char current-point))))
145+
(forward-sexp))))
146146

147147
(defun cider-create-macroexpansion-buffer ()
148148
"Create a new macroexpansion buffer."

0 commit comments

Comments
 (0)