all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [ihs_4664@yahoo.com: Re: Crash calling md5 for a list of buffers]
       [not found] <E1Ajk3o-0005Wo-Nv@fencepost.gnu.org>
@ 2004-01-23  0:22 ` Kenichi Handa
  0 siblings, 0 replies; only message in thread
From: Kenichi Handa @ 2004-01-23  0:22 UTC (permalink / raw)
  Cc: rms, handa

In article <E1Ajk3o-0005Wo-Nv@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:

> Can you take a look at this?
> ------- Start of forwarded message -------
> To: gnu-emacs-bug@moderators.isc.org
> From: Kevin Rodgers <ihs_4664@yahoo.com>
> Newsgroups: gnu.emacs.bug
> Date: Wed, 21 Jan 2004 10:20:41 -0700
[...]
> Subject: Re: Crash calling md5 for a list of buffers
[...]
>>  Try to eval (mapcar '(lambda (b) (md5 b nil nil 'raw-text)) (buffer-list)).
>>  (mapcar 'md5 (buffer-list)) doesn't work for all buffers (really I don't 
>>  understand why - probably the coding system determined automagically is
>>  not always valid for Fmd5).

I found that function md5 (in fns.c) doesn't pay attention
to the case that the current buffer is different from OBJECT
arg.  Coding system has nothing to do with this bug.  As
I've just committed the atttached change, please try again.
As this bug is serious, I committed it also to RC branch.

> There is something screwy with that file that causes Emacs to
> think it has 1 more character (459097) than it really does (459096).

That's normal because buffer position starts from 1, not 0.

---
Ken'ichi HANDA
handa@m17n.org

2004-01-23  Kenichi Handa  <handa@m17n.org>

	* fns.c (Fmd5): If OBJECT is a buffer different from the current
	one, set buffer to OBJECT temporarily.

Index: fns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fns.c,v
retrieving revision 1.354
diff -u -c -r1.354 fns.c
cvs server: conflicting specifications of output style
*** fns.c	29 Dec 2003 13:51:54 -0000	1.354
--- fns.c	23 Jan 2004 00:09:20 -0000
***************
*** 5454,5465 ****
      }
    else
      {
        CHECK_BUFFER (object);
  
        bp = XBUFFER (object);
  
        if (NILP (start))
! 	b = BUF_BEGV (bp);
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (start);
--- 5454,5471 ----
      }
    else
      {
+       struct buffer *prev = current_buffer;
+ 
+       record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ 
        CHECK_BUFFER (object);
  
        bp = XBUFFER (object);
+       if (bp != current_buffer)
+ 	set_buffer_internal (bp);
  
        if (NILP (start))
! 	b = BEGV;
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (start);
***************
*** 5467,5473 ****
  	}
  
        if (NILP (end))
! 	e = BUF_ZV (bp);
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (end);
--- 5473,5479 ----
  	}
  
        if (NILP (end))
! 	e = ZV;
        else
  	{
  	  CHECK_NUMBER_COERCE_MARKER (end);
***************
*** 5477,5483 ****
        if (b > e)
  	temp = b, b = e, e = temp;
  
!       if (!(BUF_BEGV (bp) <= b && e <= BUF_ZV (bp)))
  	args_out_of_range (start, end);
  
        if (NILP (coding_system))
--- 5483,5489 ----
        if (b > e)
  	temp = b, b = e, e = temp;
  
!       if (!(BEGV <= b && e <= ZV))
  	args_out_of_range (start, end);
  
        if (NILP (coding_system))
***************
*** 5544,5549 ****
--- 5550,5560 ----
  	}
  
        object = make_buffer_string (b, e, 0);
+       if (prev != current_buffer)
+ 	set_buffer_internal (prev);
+       /* Discard the unwind protect for recovering the current
+ 	 buffer.  */
+       specpdl_ptr--;
  
        if (STRING_MULTIBYTE (object))
  	object = code_convert_string1 (object, coding_system, Qnil, 1);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-23  0:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1Ajk3o-0005Wo-Nv@fencepost.gnu.org>
2004-01-23  0:22 ` [ihs_4664@yahoo.com: Re: Crash calling md5 for a list of buffers] Kenichi Handa

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.