unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Richard M. Stallman" <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Infinite loop in whitespace-buffer-trailing-cleanup
Date: Mon, 04 Jul 2005 10:51:52 -0400	[thread overview]
Message-ID: <E1DpSIa-0001Xf-MY@fencepost.gnu.org> (raw)
In-Reply-To: <871x6g6o4l.fsf@orebokech.com> (message from Romain Francoise on Sun, 03 Jul 2005 15:00:10 +0200)

Does this make it work?

*** 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."

  reply	other threads:[~2005-07-04 14:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-03 12:13 Infinite loop in whitespace-buffer-trailing-cleanup Romain Francoise
2005-07-03 13:00 ` Romain Francoise
2005-07-04 14:51   ` Richard M. Stallman [this message]
2005-07-05 18:22     ` Romain Francoise

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1DpSIa-0001Xf-MY@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).