[Top][All Lists]

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

Re: sort-lines in HEAD is not compatible with current Emacs - with patch

From: Ehud Karni
Subject: Re: sort-lines in HEAD is not compatible with current Emacs - with patch
Date: Sun, 30 Mar 2003 00:42:13 +0300

Hash: SHA1

On Sat, 29 Mar 2003 13:39:42 -0500, Richard Stallman <address@hidden> wrote:
> The code that you removed was designed specifically to prevent
> the specific problem that you've recorded.  So it is very strange
> that you need to take it out to fix the problem.
> Could you see where the markers are at these points in the code:
> here
Markers: beg=#<81>, in=#<129>, end=#<177>          initial 
> !     (insert-before-markers " ")
> here
Markers: beg=#<81>, in=#<129>, end=#<178>          OK
> !     ;; Delete the original copy of the text.
> !     (delete-region min max)
> here
Markers: beg=#<81>, in=#<81>, end=#<82>            OK
> !     ;; Now replace the separator " " with the sorted text.
> !     (goto-char (point-max))
  This line is the bug, It should be changed to:  (goto-char min)
  otherwise insertion is done AFTER the marker !!!

>       (insert-buffer-substring temp-buffer)
> here
Markers: beg=#<81>, in=#<81>, end=#<82>    NOT good, end should be 178

> !     (delete-region min (1+ min))))))
  This should be: (delete-region max (1+ max))))))
  because the insertion must be done before the added space.
> here
Markers: beg=#<81>, in=#<81>, end=#<81>

The bug can be fixed by the code I submitted the 1st time or by the 2
changes above. My original solution has less code but enlarge the 
original buffer by the size of the sorted region for a brief time (it
does the delete AFTER insertion while the above code does it BEFORE).


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:address@hidden                  Better  Safe  Than  Sorry
Comment: use http://www.keyserver.net/ to get my key (and others)


reply via email to

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