Subject: bug#12387: 24.2.50; File column printed by list-buffers is bad if done in dired-mode

From: martin rudalics <[email-masked]>
Date: Thu, 13 Sep 2012 11:37:07 +0200

> Seems that format-mode-line (as of ~ 1 month) fails to preserve
 > current-buffer:
 >
 > Evalute in *scratch*:
 >
 > (let ((buffer (get-buffer "*Messages*")))
 >   (with-current-buffer buffer
 >     (message "1 %s" (current-buffer))
 >     (format-mode-line mode-name nil nil buffer)
 >     (message "2 %s" (current-buffer))))

Looks like a fallout from my

2012-08-20  Martin Rudalics  <[email-masked]>

	* window.c (select_window): Always make selected window's buffer
	current.

Does the patch below fix it?

martin

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-09-12 00:14:50 +0000
+++ src/xdisp.c	2012-09-13 09:31:34 +0000
@@ -21039,8 +21039,7 @@
      : EQ (face, Qtool_bar) ? TOOL_BAR_FACE_ID
      : DEFAULT_FACE_ID;

-  if (XBUFFER (buffer) != current_buffer)
-    old_buffer = current_buffer;
+  old_buffer = current_buffer;

    /* Save things including mode_line_proptrans_alist,
       and set that to nil so that we don't alter the outer value.  */
@@ -21051,8 +21050,7 @@
    mode_line_proptrans_alist = Qnil;

    Fselect_window (window, Qt);
-  if (old_buffer)
-    set_buffer_internal_1 (XBUFFER (buffer));
+  set_buffer_internal_1 (XBUFFER (buffer));

    init_iterator (&it, w, -1, -1, NULL, face_id);