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

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

Re: emacs crashes with eval-region and marker


From: Lute Kamstra
Subject: Re: emacs crashes with eval-region and marker
Date: Fri, 08 Apr 2005 14:36:09 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Lute Kamstra <address@hidden> writes:

> address@hidden (Kim F. Storm) writes:
>
> [...]
>
>> That's the analysis -- I'm not sure how to fix the problem.
>
> Shouldn't Fprint (and other functions that accept a marker as output
> stream) just check if the marker is within the accessible part of the
> buffer and signal an error otherwise?

What about this fix?

Lute.


Index: src/print.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/print.c,v
retrieving revision 1.208
diff -c -r1.208 print.c
*** src/print.c 9 Nov 2004 13:24:35 -0000       1.208
--- src/print.c 8 Apr 2005 12:32:06 -0000
***************
*** 1,6 ****
  /* Lisp object printing and output streams.
!    Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98, 1999, 2000, 01, 03, 2004
!       Free Software Foundation, Inc.
  
  This file is part of GNU Emacs.
  
--- 1,6 ----
  /* Lisp object printing and output streams.
!    Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999,
!      2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
  
  This file is part of GNU Emacs.
  
***************
*** 195,200 ****
--- 195,201 ----
     struct buffer *old = current_buffer;                                       
\
     int old_point = -1, start_point = -1;                              \
     int old_point_byte = -1, start_point_byte = -1;                    \
+    int marker_pos = -1;                                                       
\
     int specpdl_count = SPECPDL_INDEX ();                              \
     int free_print_buffer = 0;                                         \
     int multibyte = !NILP (current_buffer->enable_multibyte_characters);       
\
***************
*** 211,223 ****
       }                                                                        
\
     if (MARKERP (printcharfun))                                                
\
       {                                                                        
\
!        if (!(XMARKER (original)->buffer))                             \
           error ("Marker does not point anywhere");                    \
!        if (XMARKER (original)->buffer != current_buffer)              \
!          set_buffer_internal (XMARKER (original)->buffer);            \
         old_point = PT;                                                        
\
         old_point_byte = PT_BYTE;                                      \
!        SET_PT_BOTH (marker_position (printcharfun),                   \
                    marker_byte_position (printcharfun));               \
         start_point = PT;                                              \
         start_point_byte = PT_BYTE;                                    \
--- 212,227 ----
       }                                                                        
\
     if (MARKERP (printcharfun))                                                
\
       {                                                                        
\
!        if (!(XMARKER (printcharfun)->buffer))                         \
           error ("Marker does not point anywhere");                    \
!        if (XMARKER (printcharfun)->buffer != current_buffer)          \
!          set_buffer_internal (XMARKER (printcharfun)->buffer);                
\
!        marker_pos = marker_position (printcharfun);                   \
!        if (marker_pos < BEGV || marker_pos > ZV)                      \
!        error ("Marker is outside the accessible part of the buffer"); \
         old_point = PT;                                                        
\
         old_point_byte = PT_BYTE;                                      \
!        SET_PT_BOTH (marker_pos,                                               
\
                    marker_byte_position (printcharfun));               \
         start_point = PT;                                              \
         start_point_byte = PT_BYTE;                                    \




reply via email to

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