aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-07-08 22:33:00 +0000
committerRichard M. Stallman2005-07-08 22:33:00 +0000
commit185d43ee89e50224fb73b317ee739ac58e6fd6f8 (patch)
tree187043267a03b24f888d91e3c8c9addec392905e
parentc32e5fb00d2866866dea360be788f4b7c4c0b0bf (diff)
downloademacs-185d43ee89e50224fb73b317ee739ac58e6fd6f8.tar.gz
emacs-185d43ee89e50224fb73b317ee739ac58e6fd6f8.zip
(whitespace-buffer-leading-cleanup): Simplify w/ skip-chars-forward.
(whitespace-buffer-trailing-cleanup): Simplify w/ skip-chars-backward.
-rw-r--r--lisp/whitespace.el39
1 files changed, 8 insertions, 31 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index f1255df9482..f09113a3690 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -608,17 +608,9 @@ whitespace problems."
608(defun whitespace-buffer-leading-cleanup () 608(defun whitespace-buffer-leading-cleanup ()
609 "Remove any empty lines at the top of the file." 609 "Remove any empty lines at the top of the file."
610 (save-excursion 610 (save-excursion
611 (let ((pmin nil) 611 (goto-char (point-min))
612 (pmax nil)) 612 (skip-chars-forward "\n")
613 (goto-char (point-min)) 613 (delete-region (point-min) (point))))
614 (beginning-of-line)
615 (setq pmin (point))
616 (end-of-line)
617 (setq pmax (point))
618 (if (equal pmin pmax)
619 (progn
620 (kill-line)
621 (whitespace-buffer-leading-cleanup))))))
622 614
623(defun whitespace-buffer-trailing () 615(defun whitespace-buffer-trailing ()
624 "Check to see if are is more than one empty line at the bottom." 616 "Check to see if are is more than one empty line at the bottom."
@@ -647,26 +639,11 @@ whitespace problems."
647(defun whitespace-buffer-trailing-cleanup () 639(defun whitespace-buffer-trailing-cleanup ()
648 "Delete all the empty lines at the bottom." 640 "Delete all the empty lines at the bottom."
649 (save-excursion 641 (save-excursion
650 (let ((pmin nil) 642 (goto-char (point-max))
651 (pmax nil)) 643 (skip-chars-backward "\n")
652 (goto-char (point-max)) 644 (if (not (bolp))
653 (beginning-of-line) 645 (forward-char 1))
654 (setq pmin (point)) 646 (delete-region (point) (point-max))))
655 (end-of-line)
656 (setq pmax (point))
657 (if (equal pmin pmax)
658 (progn
659 (goto-char (1- pmin))
660 (beginning-of-line)
661 (setq pmin (point))
662 (end-of-line)
663 (setq pmax (point))
664 (if (equal pmin pmax)
665 (progn
666 (goto-char (1- (point-max)))
667 (beginning-of-line)
668 (kill-line)
669 (whitespace-buffer-trailing-cleanup))))))))
670 647
671(defun whitespace-buffer-search (regexp) 648(defun whitespace-buffer-search (regexp)
672 "Search for any given whitespace REGEXP." 649 "Search for any given whitespace REGEXP."