Skip to content

Commit

Permalink
Change for older Emacs
Browse files Browse the repository at this point in the history
  • Loading branch information
greghendershott committed Jan 7, 2025
1 parent 9e357bb commit 0bde2db
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions racket-edit.el
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,24 @@ about shifting positions of later items.
The biggest wrinkle here is that, for esthetics, we want to
remove surrounding whitepsace when deleting. Otherwise, for
replacing, it suffices to make the change and re-indent."
(dolist (change changes)
(pcase change
(`(delete ,pos ,span)
(delete-region pos (+ pos span))
(save-excursion
(goto-char pos)
(if (save-excursion
(forward-line 0)
(looking-at "[ \t]*)" t))
(delete-indentation) ;i.e. join-line
(delete-blank-lines))))
(`(replace ,pos ,span ,str)
(delete-region pos (+ pos span))
(save-excursion
(goto-char pos)
(insert str)
(indent-region pos (point)))))))
(save-match-data
(dolist (change changes)
(pcase change
(`(delete ,pos ,span)
(delete-region pos (+ pos span))
(save-excursion
(goto-char pos)
(if (save-excursion
(forward-line 0)
(looking-at "[ \t]*)"))
(delete-indentation) ;i.e. join-line
(delete-blank-lines))))
(`(replace ,pos ,span ,str)
(delete-region pos (+ pos span))
(save-excursion
(goto-char pos)
(insert str)
(indent-region pos (point))))))))

(defun racket--submodule-y-or-n-p ()
(save-excursion
Expand Down

0 comments on commit 0bde2db

Please sign in to comment.