all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 9006@debbugs.gnu.org
Subject: bug#9006: 24.0.50; Abort in unshow_buffer/kill-buffer
Date: Mon, 11 Jul 2011 21:14:07 +0200	[thread overview]
Message-ID: <4E1B4B7F.8090500@gmx.at> (raw)
In-Reply-To: <87zkklx4gl.fsf@escher.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]

 > I applied the patch and rebuilt Emacs, then started with my
 > initializations under gdb.  Emacs came up fine, then I type C-h C-a and
 > it aborted in unshow_buffer; the backtrace is almost identical to the
 > one I posted previously.

Why am I not surprised?  Though, it doesn't abort here.

 > Then I started Emacs again, started Gnus, as
 > with your first suggested patch with set_marker_both (w->buffer, BEG,
 > BEGV)

I suppose you mean set_marker_both (w->pointm, w->buffer, BEG, BEGV)
here.

 > the display was unstable (unselected window at first blank, then
 > blank fringe), then tried `h' and it worked a few times but the response
 > was slow, and then (after `h' not C-g) Emacs aborted in unshow_buffer;
 > backtrace below.  Just out of curiosity (since I don't understand the
 > code), I rebuilt again with the following call (old_buffer instead of
 > w->buffer):
 >
 >        set_marker_both
 >  	(w->pointm, old_buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
 >
 > This did not cause an abort with C-h C-a nor with h in Gnus, but it
 > showed the same problem of point in the non-selected window jumping to
 > point-min, despite not passing BEG and BEGV.

The strange thing about this is that when old_buffer is not the current
buffer, this will set the marker in the wrong buffer which should cause
an abort.  But as I stated earlier I'm still completely lost here :-(

Anyway, I attached another patch.  Things are getting more and more
complicated because I have zero experience working with markers in C.

martin

[-- Attachment #2: indent.diff --]
[-- Type: text/plain, Size: 1951 bytes --]

=== modified file 'src/indent.c'
*** src/indent.c	2011-07-10 08:20:10 +0000
--- src/indent.c	2011-07-11 19:05:41 +0000
***************
*** 1985,1991 ****
    struct text_pos pt;
    struct window *w;
    Lisp_Object old_buffer;
!   struct gcpro gcpro1;
    Lisp_Object lcols = Qnil;
    double cols IF_LINT (= 0);
  
--- 1985,1992 ----
    struct text_pos pt;
    struct window *w;
    Lisp_Object old_buffer;
!   EMACS_INT old_charpos, old_bytepos;
!   struct gcpro gcpro1, gcpro2, gcpro3;
    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)
--- 2006,2021 ----
    w = XWINDOW (window);
  
    old_buffer = Qnil;
!   GCPRO3 (old_buffer, old_charpos, old_bytepos);
    if (XBUFFER (w->buffer) != current_buffer)
      {
        /* Set the window's buffer temporarily to the current buffer.  */
        old_buffer = w->buffer;
+       old_charpos = XMARKER (w->pointm)->charpos;
+       old_bytepos = XMARKER (w->pointm)->bytepos;
        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));
  }
--- 2136,2145 ----
      }
  
    if (BUFFERP (old_buffer))
!     {
!       w->buffer = old_buffer;
!       set_marker_both (w->pointm, w->buffer, old_charpos, old_bytepos);
!     }
  
    RETURN_UNGCPRO (make_number (it.vpos));
  }


  reply	other threads:[~2011-07-11 19:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 23:20 bug#9006: 24.0.50; Abort in unshow_buffer/kill-buffer Stephen Berman
2011-07-06  9:25 ` martin rudalics
2011-07-06 19:19   ` Stephen Berman
2011-07-07  8:23     ` martin rudalics
2011-07-07  9:32       ` Stephen Berman
2011-07-07 15:47         ` martin rudalics
2011-07-08 23:03           ` Stephen Berman
2011-07-09  8:44             ` martin rudalics
2011-07-09 11:57               ` Stephen Berman
2011-07-09 13:01                 ` martin rudalics
2011-07-09 16:27                   ` Stephen Berman
2011-07-09 16:54                     ` Stephen Berman
2011-07-10  8:59                       ` martin rudalics
2011-07-10 10:25                         ` Stephen Berman
2011-07-10 13:30                           ` martin rudalics
2011-07-10 20:31                             ` Stephen Berman
2011-07-11 19:14                               ` martin rudalics [this message]
2011-07-11 20:04                                 ` Stephen Berman
2011-07-12  8:36                                   ` martin rudalics
2011-07-12  8:51                                     ` Stephen Berman
2011-07-13  6:53                                     ` Stephen Berman
2011-07-13  7:24                                       ` Eli Zaretskii
2011-07-13  8:00                                         ` Stephen Berman
2011-07-13 10:03                                           ` Eli Zaretskii
2011-07-13 11:40                                             ` Stephen Berman
2011-07-13  8:37                                       ` martin rudalics
2011-07-13 10:05                                         ` Eli Zaretskii
2011-07-13 11:54                                           ` martin rudalics
2011-07-13 12:20                                             ` Stephen Berman
2011-07-13 11:39                                         ` Stephen Berman
2011-07-14  8:35                                       ` martin rudalics
2011-07-15 21:05                                         ` Stephen Berman
2011-07-10  8:58                     ` martin rudalics
2011-07-09 12:44               ` Stephen Berman
2011-07-09 13:01                 ` martin rudalics
2011-07-09 17:31               ` Eli Zaretskii
2011-07-10  8:59                 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E1B4B7F.8090500@gmx.at \
    --to=rudalics@gmx.at \
    --cc=9006@debbugs.gnu.org \
    --cc=stephen.berman@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.