GNU bug report logs - #11665
kill-buffer gives an error on killing dead buffers

Previous Next

Package: emacs;

Reported by: Vitalie Spinu <spinuvit <at> gmail.com>

Date: Sun, 10 Jun 2012 11:01:02 UTC

Severity: normal

Tags: patch

Fixed in version 24.2

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 11665 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Vitalie Spinu <spinuvit <at> gmail.com>
Cc: 11665 <at> debbugs.gnu.org
Subject: Re: bug#11665: kill-buffer gives an error on killing dead buffers
Date: Sun, 10 Jun 2012 19:49:29 +0200
[Message part 1 (text/plain, inline)]
There seem more occasions where this problem could strike.  Also, we
should return t when we find out that the buffer name has been reset to
nil under our feet.  Patch attached, comments welcome.

martin
[buffer.c.diff (text/plain, inline)]
*** src/buffer.c	2012-05-29 16:13:38 +0000
--- src/buffer.c	2012-06-10 17:33:15 +0000
***************
*** 1493,1498 ****
--- 1493,1502 ----
      unbind_to (count, Qnil);
    }
  
+   /* If the hooks have killed the buffer, exit now.  */
+   if (NILP (BVAR (b, name)))
+     return Qt;
+ 
    /* We have no more questions to ask.  Verify that it is valid
       to kill the buffer.  This must be done after the questions
       since anything can happen within do_yes_or_no_p.  */
***************
*** 1501,1509 ****
    if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
      return Qnil;
  
-   if (NILP (BVAR (b, name)))
-     return Qnil;
- 
    /* When we kill a base buffer, kill all its indirect buffers.
       We do it at this stage so nothing terrible happens if they
       ask questions or their hooks get errors.  */
--- 1505,1510 ----
***************
*** 1526,1540 ****
        UNGCPRO;
      }
  
    /* Run replace_buffer_in_windows before making another buffer current
       since set-window-buffer-start-and-point will refuse to make another
       buffer current if the selected window does not show the current
       buffer.  (Bug#10114) */
    replace_buffer_in_windows (buffer);
  
!      /* Make this buffer not be current.
!      In the process, notice if this is the sole visible buffer
!      and give up if so.  */
    if (b == current_buffer)
      {
        tem = Fother_buffer (buffer, Qnil, Qnil);
--- 1527,1549 ----
        UNGCPRO;
      }
  
+   /* If killing the indirect buffers has killed our buffer, return.  */
+   if (NILP (BVAR (b, name)))
+     return Qt;
+ 
    /* Run replace_buffer_in_windows before making another buffer current
       since set-window-buffer-start-and-point will refuse to make another
       buffer current if the selected window does not show the current
       buffer.  (Bug#10114) */
    replace_buffer_in_windows (buffer);
  
!   /* If replacing the buffer in windows has killed our buffer,
!      return.  */
!   if (NILP (BVAR (b, name)))
!     return Qt;
! 
!   /* Make this buffer not be current.  In the process, notice if this is
!      the sole visible buffer and give up if so.  */
    if (b == current_buffer)
      {
        tem = Fother_buffer (buffer, Qnil, Qnil);
***************
*** 1564,1574 ****
    kill_buffer_processes (buffer);
    UNGCPRO;
  
!   /* Killing buffer processes may run sentinels which may
!      have called kill-buffer.  */
! 
    if (NILP (BVAR (b, name)))
!     return Qnil;
  
    /* These may run Lisp code and into infinite loops (if someone
       insisted on circular lists) so allow quitting here.  */
--- 1573,1582 ----
    kill_buffer_processes (buffer);
    UNGCPRO;
  
!   /* Killing buffer processes may run sentinels which may have called
!      kill-buffer.  */
    if (NILP (BVAR (b, name)))
!     return Qt;
  
    /* These may run Lisp code and into infinite loops (if someone
       insisted on circular lists) so allow quitting here.  */
***************
*** 1599,1604 ****
--- 1607,1616 ----
  	internal_delete_file (BVAR (b, auto_save_file_name));
      }
  
+   /* Deleting a file could have killed our buffer.  */
+   if (NILP (BVAR (b, name)))
+     return Qt;
+ 
    if (b->base_buffer)
      {
        /* Unchain all markers that belong to this indirect buffer.


This bug report was last modified 12 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.