aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2006-08-18 12:50:08 +0000
committerEli Zaretskii2006-08-18 12:50:08 +0000
commit6e6f0cb6ab4c8df5f33d5d857147f15a52400bf2 (patch)
tree28a75a4dd8fb02bc23105147da2d8c19ac223615
parentb8ae17637ce688e240446e680ee930002fd8beec (diff)
downloademacs-6e6f0cb6ab4c8df5f33d5d857147f15a52400bf2.tar.gz
emacs-6e6f0cb6ab4c8df5f33d5d857147f15a52400bf2.zip
(whitespace-cleanup-internal): New optional arg REGION-ONLY. If it's non-nil,
modify the message to the user accordingly. (whitespace-cleanup-region): Call whitespace-cleanup-internal with a non-nil argument.
-rw-r--r--lisp/whitespace.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 449606607f6..1d162e515e4 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -524,7 +524,7 @@ See `whitespace-buffer' docstring for a summary of the problems."
524 (whitespace-cleanup-region (region-beginning) (region-end)) 524 (whitespace-cleanup-region (region-beginning) (region-end))
525 (whitespace-cleanup-internal))) 525 (whitespace-cleanup-internal)))
526 526
527(defun whitespace-cleanup-internal () 527(defun whitespace-cleanup-internal (&optional region-only)
528 ;; If this buffer really contains a file, then run, else quit. 528 ;; If this buffer really contains a file, then run, else quit.
529 (whitespace-check-whitespace-mode current-prefix-arg) 529 (whitespace-check-whitespace-mode current-prefix-arg)
530 (if (and buffer-file-name whitespace-mode) 530 (if (and buffer-file-name whitespace-mode)
@@ -569,9 +569,12 @@ See `whitespace-buffer' docstring for a summary of the problems."
569 ;; Call this recursively till everything is taken care of 569 ;; Call this recursively till everything is taken care of
570 (if whitespace-any 570 (if whitespace-any
571 (whitespace-cleanup-internal) 571 (whitespace-cleanup-internal)
572 ;; if we are done, talk to the user
572 (progn 573 (progn
573 (if (not whitespace-silent) 574 (unless whitespace-silent
574 (message "%s clean" buffer-file-name)) 575 (if region-only
576 (message "The region is now clean")
577 (message "%s is now clean" buffer-file-name)))
575 (whitespace-update-modeline))) 578 (whitespace-update-modeline)))
576 (setq tab-width whitespace-tabwith-saved)))) 579 (setq tab-width whitespace-tabwith-saved))))
577 580
@@ -582,7 +585,7 @@ See `whitespace-buffer' docstring for a summary of the problems."
582 (save-excursion 585 (save-excursion
583 (save-restriction 586 (save-restriction
584 (narrow-to-region s e) 587 (narrow-to-region s e)
585 (whitespace-cleanup-internal)) 588 (whitespace-cleanup-internal t))
586 (whitespace-buffer t))) 589 (whitespace-buffer t)))
587 590
588(defun whitespace-buffer-leading () 591(defun whitespace-buffer-leading ()