Bug#273123: Patch

2005-08-09 Thread Romain Francoise
Jérôme Marant [EMAIL PROTECTED] writes:

 Would you mind providing this patch as a dpatch please?

Erm, ok, here goes:

#! /bin/sh /usr/share/dpatch/dpatch-run
## whitespace-readonly-infloop.dpatch by Romain Francoise [EMAIL PROTECTED]
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: ** Avoid an infinite loop in whitespace.el if kill-read-only is
## DP: set to t.
## DP: Status: has been incorporated upstream
## DP: Provided by: Richard Stallman [EMAIL PROTECTED]
## DP: Date: Tue, 09 Aug 2005 16:47:25 +0200

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./lisp/whitespace.el 
/tmp/dpep-work.Gk47lX/emacs21-21.4a/lisp/whitespace.el
--- ./lisp/whitespace.el2001-08-20 22:56:08.0 +0200
+++ /tmp/dpep-work.Gk47lX/emacs21-21.4a/lisp/whitespace.el  2005-08-09 
16:45:25.0 +0200
@@ -504,17 +504,9 @@
 (defun whitespace-buffer-leading-cleanup ()
   Remove any empty lines at the top of the file.
   (save-excursion
-(let ((pmin nil)
- (pmax nil))
-  (goto-char (point-min))
-  (beginning-of-line)
-  (setq pmin (point))
-  (end-of-line)
-  (setq pmax (point))
-  (if (equal pmin pmax)
- (progn
-   (kill-line)
-   (whitespace-buffer-leading-cleanup))
+(goto-char (point-min))
+(skip-chars-forward \n)
+(delete-region (point-min) (point
 
 (defun whitespace-buffer-trailing ()
   Check to see if are is more than one empty line at the bottom.
@@ -541,26 +533,11 @@
 (defun whitespace-buffer-trailing-cleanup ()
   Delete all the empty lines at the bottom.
   (save-excursion
-(let ((pmin nil)
- (pmax nil))
-  (goto-char (point-max))
-  (beginning-of-line)
-  (setq pmin (point))
-  (end-of-line)
-  (setq pmax (point))
-  (if (equal pmin pmax)
- (progn
-   (goto-char (1- pmin))
-   (beginning-of-line)
-   (setq pmin (point))
-   (end-of-line)
-   (setq pmax (point))
-   (if (equal pmin pmax)
-   (progn
- (goto-char (1- (point-max)))
- (beginning-of-line)
- (kill-line)
- (whitespace-buffer-trailing-cleanup
+(goto-char (point-max))
+(skip-chars-backward \n)
+(if (not (bolp))
+   (forward-char 1))
+(delete-region (point) (point-max
 
 (defun whitespace-buffer-search (regexp)
   Search for any given whitespace REGEXP.

-- 
  ,''`.
 : :' :Romain Francoise [EMAIL PROTECTED]
 `. `' http://people.debian.org/~rfrancoise/
   `-



Bug#273123: Patch

2005-07-09 Thread Romain Francoise
tags 273123 patch
quit

RMS sent me the following patch, it prevents the segfault (by signalling
a buffer is read-only error).  It's against CVS but applies cleanly to
the Debian sources.

*** whitespace.el   10 Jun 2005 09:28:20 -0400  1.36
--- whitespace.el   04 Jul 2005 09:37:22 -0400  
***
*** 608,624 
  (defun whitespace-buffer-leading-cleanup ()
Remove any empty lines at the top of the file.
(save-excursion
! (let ((pmin nil)
! (pmax nil))
!   (goto-char (point-min))
!   (beginning-of-line)
!   (setq pmin (point))
!   (end-of-line)
!   (setq pmax (point))
!   (if (equal pmin pmax)
! (progn
!   (kill-line)
!   (whitespace-buffer-leading-cleanup))
  
  (defun whitespace-buffer-trailing ()
Check to see if are is more than one empty line at the bottom.
--- 608,616 
  (defun whitespace-buffer-leading-cleanup ()
Remove any empty lines at the top of the file.
(save-excursion
! (goto-char (point-min))
! (skip-chars-forward \n)
! (delete-region (point-min) (point
  
  (defun whitespace-buffer-trailing ()
Check to see if are is more than one empty line at the bottom.
***
*** 647,672 
  (defun whitespace-buffer-trailing-cleanup ()
Delete all the empty lines at the bottom.
(save-excursion
! (let ((pmin nil)
! (pmax nil))
!   (goto-char (point-max))
!   (beginning-of-line)
!   (setq pmin (point))
!   (end-of-line)
!   (setq pmax (point))
!   (if (equal pmin pmax)
! (progn
!   (goto-char (1- pmin))
!   (beginning-of-line)
!   (setq pmin (point))
!   (end-of-line)
!   (setq pmax (point))
!   (if (equal pmin pmax)
!   (progn
! (goto-char (1- (point-max)))
! (beginning-of-line)
! (kill-line)
! (whitespace-buffer-trailing-cleanup
  
  (defun whitespace-buffer-search (regexp)
Search for any given whitespace REGEXP.
--- 639,649 
  (defun whitespace-buffer-trailing-cleanup ()
Delete all the empty lines at the bottom.
(save-excursion
! (goto-char (point-max))
! (skip-chars-backward \n)
! (if (not (bolp))
!   (forward-char 1))
! (delete-region (point) (point-max
  
  (defun whitespace-buffer-search (regexp)
Search for any given whitespace REGEXP.

-- 
  ,''`.
 : :' :Romain Francoise [EMAIL PROTECTED]
 `. `' http://people.debian.org/~rfrancoise/
   `-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]