Subject: Re: bug#68235: 29.1.90; Switching tabs stops following process output in selected window

From: martin rudalics <[email-masked]>
Date: Tue, 9 Apr 2024 11:22:21 +0200

> The problem is that 'image-next-file' calls 'find-alternate-file'
 > that does such buffer renaming:
 >
 >      (if (get-buffer " **lose**")
 > 	(kill-buffer " **lose**"))
 >      (rename-buffer " **lose**")
 >
 > and 'rename-buffer' changes the buffer's last name to **lose**.

Isn't the problem that it leaves the last name nil?  Does the attached
diff fix it?

Thanks, martin

diff --git a/src/buffer.c b/src/buffer.c
index 291c7d3f911..5e2386c94fa 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1686,7 +1686,11 @@ DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
 	 with the original name.  It makes UNIQUE equivalent to
 	 (rename-buffer (generate-new-buffer-name NEWNAME)).  */
       if (NILP (unique) && XBUFFER (tem) == current_buffer)
-	return BVAR (current_buffer, name);
+	{
+	  bset_last_name (current_buffer, oldname);
+
+	  return BVAR (current_buffer, name);
+	}
       if (!NILP (unique))
 	newname = Fgenerate_new_buffer_name (newname, oldname);
       else