[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: |
Mon, 31 Mar 2003 19:26:58 +0300 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 31 Mar 2003 03:37:15 -0500, Richard Stallman <address@hidden> wrote:
>
> *** sort.el.~1.44.~ Wed Feb 12 02:22:16 2003
> --- sort.el Sun Mar 30 23:13:45 2003
> ***************
> *** 199,207 ****
> ;; Delete the original copy of the text.
> (delete-region min max)
> ;; Now replace the separator " " with the sorted text.
> ! (goto-char (point-max))
> (insert-buffer-substring temp-buffer)
> ! (delete-region min (1+ min))))))
>
> ;;;###autoload
> (defun sort-lines (reverse beg end)
> --- 199,207 ----
> ;; Delete the original copy of the text.
> (delete-region min max)
> ;; Now replace the separator " " with the sorted text.
> ! (goto-char min)
> (insert-buffer-substring temp-buffer)
> ! (delete-region max (1+ max))))))
>
> ;;;###autoload
> (defun sort-lines (reverse beg end)
The above code is working fine, but I have better solution:
*** /usr/local/share/emacs/21.3.50/lisp/sort-org.el Mon Feb 10 23:36:03 2003
- --- /usr/local/share/emacs/21.3.50/lisp/sort.el Mon Mar 31 19:15:44 2003
***************
*** 190,207 ****
;; Copy the reordered text from the temporary buffer
;; to the buffer we sorted (OLD-BUFFER).
(set-buffer old-buffer)
(let ((inhibit-quit t))
;; Make sure insertions done for reordering
! ;; do not go after any markers at the end of the sorted region,
! ;; by inserting a space to separate them.
! (goto-char max)
! (insert-before-markers " ")
! ;; Delete the original copy of the text.
! (delete-region min max)
;; Now replace the separator " " with the sorted text.
! (goto-char (point-max))
(insert-buffer-substring temp-buffer)
! (delete-region min (1+ min))))))
;;;###autoload
(defun sort-lines (reverse beg end)
- --- 190,205 ----
;; Copy the reordered text from the temporary buffer
;; to the buffer we sorted (OLD-BUFFER).
(set-buffer old-buffer)
(let ((inhibit-quit t))
;; Make sure insertions done for reordering
! ;; saves any markers at the end of the sorted region,
! ;; by leaving the last character of the region.
! (delete-region min (1- max))
;; Now replace the separator " " with the sorted text.
! (goto-char (point-min))
(insert-buffer-substring temp-buffer)
! (delete-region max (1+ max))))))
;;;###autoload
(defun sort-lines (reverse beg end)
The "(delete-region min (1- max))" can always be done, because if
min = max (empty sort region) the `sort-reorder-buffer' is not called.
Ehud.
- --
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
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)
iD8DBQE+iGxSLFvTvpjqOY0RAinLAJ461Ff9sVBFvaFJPOwoPu5VGYqX+gCdHy2d
m4fZsK+LyZux71o26Ct0UUk=
=DzZp
-----END PGP SIGNATURE-----