Skip to content

Commit 937ae8e

Browse files
Improve racket-add-require-for-identifier
Fine-tune formatting and preservation of point.
1 parent 37f7055 commit 937ae8e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

racket-edit.el

+11-11
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,19 @@ identifiers that are exported but not documented."
246246
(racket--assert-sexp-edit-mode)
247247
(when-let (result (racket--describe-search-completing-read))
248248
(pcase-let* ((`(,term ,_path ,_anchor ,lib) result)
249-
(req (format "(require %s)" lib)))
249+
(req (format "(require %s)" lib))
250+
(pt (copy-marker (point) t)))
250251
(unless (equal (racket--thing-at-point 'symbol) term)
251252
(insert term))
252-
(save-excursion
253-
(goto-char (racket--inside-innermost-module))
254-
(insert req)
255-
(newline-and-indent)
256-
(let ((pt (copy-marker (point))))
257-
(racket--tidy-requires
258-
(lambda (result)
259-
(goto-char pt)
260-
(when result
261-
(message "Added %S and did racket-tidy-requires" req)))))))))
253+
(goto-char (racket--inside-innermost-module))
254+
(newline-and-indent)
255+
(insert req)
256+
(newline-and-indent)
257+
(racket--tidy-requires
258+
(lambda (result)
259+
(goto-char pt)
260+
(when result
261+
(message "Added %S and did racket-tidy-requires" req)))))))
262262

263263
;;; align
264264

0 commit comments

Comments
 (0)