From 3d066413de419d25c9bf33499d3b04fa321684d0 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 23 Jan 2022 20:55:08 -0800 Subject: [PATCH] =?UTF-8?q?Replace=20=E2=80=98goto-line=E2=80=99=20with=20?= =?UTF-8?q?=E2=80=98forward-line=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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’. --- vc-p4.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vc-p4.el b/vc-p4.el index 25e18ee..e6fee69 100644 --- a/vc-p4.el +++ b/vc-p4.el @@ -822,7 +822,8 @@ _VERSION is ignored." ((string= op "d") (setq ra (1+ ra)))) (with-current-buffer ch-buffer - (goto-line la) + (goto-char (point-min)) + (forward-line (1- la)) (let ((beg (point))) (forward-line (1+ (- lb la))) (delete-region beg (point))) @@ -844,7 +845,8 @@ _VERSION is ignored." " ")) xth-rev xth-date xth-auth) (with-current-buffer buffer - (goto-line 2) + (goto-char (point-min)) + (forward-line 1) (move-to-column 0) (insert (format "%10s %7s %6s %4s\n" "Date" "Author" "Change" "Rev")) (while (setq line (vc-p4-read-output ch-buffer))