# HG changeset patch # User Eli Zaretskii # Date 1155905408 0 # Node ID 384cd9b2e9775689b6747469da10f67fe39f4ab6 # Parent 672046feba650f9947c31511a9036b7fa9046e95 (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. diff -r 672046feba65 -r 384cd9b2e977 lisp/whitespace.el --- a/lisp/whitespace.el Fri Aug 18 12:41:09 2006 +0000 +++ b/lisp/whitespace.el Fri Aug 18 12:50:08 2006 +0000 @@ -524,7 +524,7 @@ (whitespace-cleanup-region (region-beginning) (region-end)) (whitespace-cleanup-internal))) -(defun whitespace-cleanup-internal () +(defun whitespace-cleanup-internal (&optional region-only) ;; If this buffer really contains a file, then run, else quit. (whitespace-check-whitespace-mode current-prefix-arg) (if (and buffer-file-name whitespace-mode) @@ -569,9 +569,12 @@ ;; Call this recursively till everything is taken care of (if whitespace-any (whitespace-cleanup-internal) + ;; if we are done, talk to the user (progn - (if (not whitespace-silent) - (message "%s clean" buffer-file-name)) + (unless whitespace-silent + (if region-only + (message "The region is now clean") + (message "%s is now clean" buffer-file-name))) (whitespace-update-modeline))) (setq tab-width whitespace-tabwith-saved)))) @@ -582,7 +585,7 @@ (save-excursion (save-restriction (narrow-to-region s e) - (whitespace-cleanup-internal)) + (whitespace-cleanup-internal t)) (whitespace-buffer t))) (defun whitespace-buffer-leading ()