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

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

bug#9006: 24.0.50; Abort in unshow_buffer/kill-buffer


From: martin rudalics
Subject: bug#9006: 24.0.50; Abort in unshow_buffer/kill-buffer
Date: Sun, 10 Jul 2011 15:30:33 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

> Is window-point set to 1 as a side effect of making the temporary
> buffer?

No.  It happens because I used BEG instead of the buffer's point.

>>                                           Rather _you_ did set the old
>> buffer's window point to 1 and it stays put there when you set w->buffer
>> to old_buffer upon exiting `vertical-motion'.
>
> Do you have a suggestion how to reset point?

I attached I patch.  It compiles but is hardly trustworthy.  For
example, old_buffer might have got killed in the meantime.

> /* If select_window is called with inhibit_point_swap non-zero it will
>    not store point of the old selected window's buffer back into that
>    window's pointm slot.  This is needed by Fset_window_configuration to
>    avoid that the display routine is called with selected_window set to
>    Qnil causing a subsequent crash.  */
>
> However, when I set a conditional breakpoint inhibit_point_swap!=0 this
> did not interrupt execution, whereas with breakpoint select_window,
> execution interrupts with inhibit_point_swap == 0, so I guess I don't
> understand the comment.

IIRC this part is only relevant when you restore a window configuration,
for example, when leaving a `save-window-excursion'.  But I wouldn't
believe my own comments.

martin
*** src/indent.c        2011-07-10 08:20:10 +0000
--- src/indent.c        2011-07-10 13:03:07 +0000
***************
*** 1984,1991 ****
    struct it it;
    struct text_pos pt;
    struct window *w;
!   Lisp_Object old_buffer;
!   struct gcpro gcpro1;
    Lisp_Object lcols = Qnil;
    double cols IF_LINT (= 0);

--- 1984,1991 ----
    struct it it;
    struct text_pos pt;
    struct window *w;
!   Lisp_Object old_buffer, old_pointm;
!   struct gcpro gcpro1, gcpro2;
    Lisp_Object lcols = Qnil;
    double cols IF_LINT (= 0);

***************
*** 2005,2016 ****
    w = XWINDOW (window);

    old_buffer = Qnil;
!   GCPRO1 (old_buffer);
    if (XBUFFER (w->buffer) != current_buffer)
      {
        /* Set the window's buffer temporarily to the current buffer.  */
        old_buffer = w->buffer;
        XSETBUFFER (w->buffer, current_buffer);
      }

    if (noninteractive)
--- 2005,2019 ----
    w = XWINDOW (window);

    old_buffer = Qnil;
!   GCPRO2 (old_buffer, old_pointm);
    if (XBUFFER (w->buffer) != current_buffer)
      {
        /* Set the window's buffer temporarily to the current buffer.  */
        old_buffer = w->buffer;
+       old_pointm = w->pointm;
        XSETBUFFER (w->buffer, current_buffer);
+       set_marker_both
+       (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE 
(current_buffer));
      }

    if (noninteractive)
***************
*** 2131,2137 ****
      }

    if (BUFFERP (old_buffer))
!     w->buffer = old_buffer;

    RETURN_UNGCPRO (make_number (it.vpos));
  }
--- 2134,2143 ----
      }

    if (BUFFERP (old_buffer))
!     {
!       w->buffer = old_buffer;
!       w->pointm = old_pointm;
!     }

    RETURN_UNGCPRO (make_number (it.vpos));
  }


reply via email to

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