emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/go-mode 41f8759 135/495: document line-offset in go--apply


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 41f8759 135/495: document line-offset in go--apply-rcs-patch
Date: Sat, 7 Aug 2021 09:04:59 -0400 (EDT)

branch: elpa/go-mode
commit 41f8759b8f57b2591d5ad5b9ac36a702da811834
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>

    document line-offset in go--apply-rcs-patch
---
 go-mode.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/go-mode.el b/go-mode.el
index ba122b8..0cc16b7 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -471,6 +471,16 @@ recommended that you look at goflymake
 
 (defun go--apply-rcs-patch (patch-buffer)
   (let ((target-buffer (current-buffer))
+        ;; Relative offset between buffer line numbers and line numbers
+        ;; in patch.
+        ;;
+        ;; Line numbers in the patch are based on the source file, so
+        ;; we have to keep an offset when making changes to the
+        ;; buffer.
+        ;;
+        ;; Appending lines decrements the offset (possibly making it
+        ;; negative), deleting lines increments it. This order
+        ;; simplifies the forward-line invocations.
         (line-offset 0))
     (save-excursion
       (with-current-buffer patch-buffer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]