Replace ‘goto-line’ with ‘forward-line’

According to the documentation of ‘goto-line’, it's usually not what you want
for a lisp program. It's not entirely clear why, but I suspect it has something
to do with either hooks run, or some effect it'll have on state.

This commit replaces it with the suggested

    (goto-char (point-min))
    (forward-line (-1 N))

Where N is the argument previously given to ‘goto-line’.
This commit is contained in:
Tom Willemse 2022-01-23 20:55:08 -08:00
parent bab0d7083d
commit 3d066413de

View file

@ -822,7 +822,8 @@ _VERSION is ignored."
((string= op "d") ((string= op "d")
(setq ra (1+ ra)))) (setq ra (1+ ra))))
(with-current-buffer ch-buffer (with-current-buffer ch-buffer
(goto-line la) (goto-char (point-min))
(forward-line (1- la))
(let ((beg (point))) (let ((beg (point)))
(forward-line (1+ (- lb la))) (forward-line (1+ (- lb la)))
(delete-region beg (point))) (delete-region beg (point)))
@ -844,7 +845,8 @@ _VERSION is ignored."
" ")) " "))
xth-rev xth-date xth-auth) xth-rev xth-date xth-auth)
(with-current-buffer buffer (with-current-buffer buffer
(goto-line 2) (goto-char (point-min))
(forward-line 1)
(move-to-column 0) (move-to-column 0)
(insert (format "%10s %7s %6s %4s\n" "Date" "Author" "Change" "Rev")) (insert (format "%10s %7s %6s %4s\n" "Date" "Author" "Change" "Rev"))
(while (setq line (vc-p4-read-output ch-buffer)) (while (setq line (vc-p4-read-output ch-buffer))