bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6454: 24.0.50; kill-buffer switches current-buffer


From: martin rudalics
Subject: bug#6454: 24.0.50; kill-buffer switches current-buffer
Date: Sat, 19 Jun 2010 15:38:29 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

(eval-when-compile
  (require 'cl))  ; for assert

(let ((buffer (generate-new-buffer "test"))
      (saved-buffer (current-buffer)))
  (unwind-protect
      (with-current-buffer buffer
        (goto-line 1 buffer))
    (assert (and buffer (not (eq buffer (current-buffer)))))
    (assert (eq (current-buffer) saved-buffer) () "before kill-buffer")
    (kill-buffer buffer)
    (assert (eq (current-buffer) saved-buffer) () "after kill-buffer")))

Helmut, please try whether the attached patch fixes your bug.

Thanks, martin

*** src/window.c        2010-06-12 11:30:48 +0000
--- src/window.c        2010-06-19 10:10:41 +0000
***************
*** 2371,2377 ****
                    /* Otherwise show a different buffer in the window.  */
                    w->dedicated = Qnil;
                    Fset_window_buffer (window, buffer, Qnil);
!                   if (EQ (window, selected_window))
                      Fset_buffer (w->buffer);
                  }
              }
--- 2371,2381 ----
                    /* Otherwise show a different buffer in the window.  */
                    w->dedicated = Qnil;
                    Fset_window_buffer (window, buffer, Qnil);
!                   /* If WINDOW is the selected window, make its buffer
!                      current.  But do so only if the window shows the
!                      current buffer (Bug#6454).  */
!                   if (EQ (window, selected_window)
!                       && XBUFFER (buffer) == current_buffer)
                      Fset_buffer (w->buffer);
                  }
              }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]