Index | Thread | Search

From:
Han Boetes <hboetes@gmail.com>
Subject:
mg: Don't try to save *scratch* when there are no changes.
To:
tech@openbsd.org
Date:
Mon, 2 Mar 2026 20:39:47 +0100

Download raw body.

Thread
Hello all,

If you open mg without argument and hit C-x C-s, mg tries to save *scratch*, whilst emacs says: (No changes need to be saved)

The patch below fixes this minor compatibility issue.

BR
Han

diff --git a/file.c b/file.c
index b01e818..d088238 100644
--- a/file.c
+++ b/file.c
@@ -565,6 +565,11 @@ static int	makebackup = TRUE;
 int
 filesave(int f, int n)
 {
+	if ((curbp->b_flag & BFCHG) == 0) {
+		ewprintf("(No changes need to be saved)");
+		return (TRUE);
+	}
+
 	if (curbp->b_fname[0] == '\0')
 		return (filewrite(f, n));
 	else