Skip to content

Commit

Permalink
fix oversight
Browse files Browse the repository at this point in the history
  • Loading branch information
raxod502 committed Nov 12, 2023
1 parent 28c4da6 commit f30de58
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions apheleia-rcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -202,33 +202,32 @@ contains the patch."
(relative-pos . ,new-relative-point))
commands))))))))))))))
(with-current-buffer content-buffer
(save-excursion
(dolist (command (nreverse commands))
(pcase (alist-get 'command command)
(`addition
(save-excursion
(goto-char (alist-get 'marker command))
(insert (alist-get 'text command))))
(`deletion
(save-excursion
(goto-char (alist-get 'marker command))
(forward-line (alist-get 'lines command))
(delete-region (alist-get 'marker command) (point))))
(`move-cursor
(let ((cursor (alist-get 'cursor command))
(offset (alist-get 'relative-pos command)))
(pcase (plist-get cursor :type)
(`point
(goto-char
(+ (point) offset)))
(`marker
(set-marker
(plist-get cursor :pos)
(+ (plist-get cursor :pos) offset)))
(`window-point
(set-window-point
(plist-get cursor :window)
(+ (point) offset))))))))))
(dolist (command (nreverse commands))
(pcase (alist-get 'command command)
(`addition
(save-excursion
(goto-char (alist-get 'marker command))
(insert (alist-get 'text command))))
(`deletion
(save-excursion
(goto-char (alist-get 'marker command))
(forward-line (alist-get 'lines command))
(delete-region (alist-get 'marker command) (point))))
(`move-cursor
(let ((cursor (alist-get 'cursor command))
(offset (alist-get 'relative-pos command)))
(pcase (plist-get cursor :type)
(`point
(goto-char
(+ (point) offset)))
(`marker
(set-marker
(plist-get cursor :pos)
(+ (plist-get cursor :pos) offset)))
(`window-point
(set-window-point
(plist-get cursor :window)
(+ (point) offset)))))))))
;; Restore the scroll position of each window displaying the
;; buffer.
(dolist (entry window-line-list)
Expand Down

0 comments on commit f30de58

Please sign in to comment.