diff options
Diffstat (limited to 'lisp/whitespace.el')
| -rw-r--r-- | lisp/whitespace.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 7f3cbd913ca..449606607f6 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -430,7 +430,7 @@ and: | |||
| 430 | (if buffer-read-only | 430 | (if buffer-read-only |
| 431 | (if (not quiet) | 431 | (if (not quiet) |
| 432 | (message "Can't cleanup: %s is read-only" (buffer-name))) | 432 | (message "Can't cleanup: %s is read-only" (buffer-name))) |
| 433 | (whitespace-cleanup)) | 433 | (whitespace-cleanup-internal)) |
| 434 | (let ((whitespace-leading (if whitespace-check-buffer-leading | 434 | (let ((whitespace-leading (if whitespace-check-buffer-leading |
| 435 | (whitespace-buffer-leading) | 435 | (whitespace-buffer-leading) |
| 436 | nil)) | 436 | nil)) |
| @@ -520,6 +520,11 @@ and: | |||
| 520 | "Cleanup the five different kinds of whitespace problems. | 520 | "Cleanup the five different kinds of whitespace problems. |
| 521 | See `whitespace-buffer' docstring for a summary of the problems." | 521 | See `whitespace-buffer' docstring for a summary of the problems." |
| 522 | (interactive) | 522 | (interactive) |
| 523 | (if (and transient-mark-mode mark-active) | ||
| 524 | (whitespace-cleanup-region (region-beginning) (region-end)) | ||
| 525 | (whitespace-cleanup-internal))) | ||
| 526 | |||
| 527 | (defun whitespace-cleanup-internal () | ||
| 523 | ;; If this buffer really contains a file, then run, else quit. | 528 | ;; If this buffer really contains a file, then run, else quit. |
| 524 | (whitespace-check-whitespace-mode current-prefix-arg) | 529 | (whitespace-check-whitespace-mode current-prefix-arg) |
| 525 | (if (and buffer-file-name whitespace-mode) | 530 | (if (and buffer-file-name whitespace-mode) |
| @@ -563,7 +568,7 @@ See `whitespace-buffer' docstring for a summary of the problems." | |||
| 563 | 568 | ||
| 564 | ;; Call this recursively till everything is taken care of | 569 | ;; Call this recursively till everything is taken care of |
| 565 | (if whitespace-any | 570 | (if whitespace-any |
| 566 | (whitespace-cleanup) | 571 | (whitespace-cleanup-internal) |
| 567 | (progn | 572 | (progn |
| 568 | (if (not whitespace-silent) | 573 | (if (not whitespace-silent) |
| 569 | (message "%s clean" buffer-file-name)) | 574 | (message "%s clean" buffer-file-name)) |
| @@ -577,7 +582,7 @@ See `whitespace-buffer' docstring for a summary of the problems." | |||
| 577 | (save-excursion | 582 | (save-excursion |
| 578 | (save-restriction | 583 | (save-restriction |
| 579 | (narrow-to-region s e) | 584 | (narrow-to-region s e) |
| 580 | (whitespace-cleanup)) | 585 | (whitespace-cleanup-internal)) |
| 581 | (whitespace-buffer t))) | 586 | (whitespace-buffer t))) |
| 582 | 587 | ||
| 583 | (defun whitespace-buffer-leading () | 588 | (defun whitespace-buffer-leading () |
| @@ -760,7 +765,7 @@ If timer is not set, then set it to scan the files in | |||
| 760 | (if whitespace-auto-cleanup | 765 | (if whitespace-auto-cleanup |
| 761 | (progn | 766 | (progn |
| 762 | ;;(message "cleaning up whitespace in %s" bufname) | 767 | ;;(message "cleaning up whitespace in %s" bufname) |
| 763 | (whitespace-cleanup)) | 768 | (whitespace-cleanup-internal)) |
| 764 | (progn | 769 | (progn |
| 765 | ;;(message "whitespace-buffer %s." (buffer-name)) | 770 | ;;(message "whitespace-buffer %s." (buffer-name)) |
| 766 | (whitespace-buffer t)))) | 771 | (whitespace-buffer t)))) |
| @@ -806,7 +811,7 @@ This is meant to be added buffer-locally to `write-file-functions'." | |||
| 806 | (interactive) | 811 | (interactive) |
| 807 | (let ((werr nil)) | 812 | (let ((werr nil)) |
| 808 | (if whitespace-auto-cleanup | 813 | (if whitespace-auto-cleanup |
| 809 | (whitespace-cleanup) | 814 | (whitespace-cleanup-internal) |
| 810 | (setq werr (whitespace-buffer))) | 815 | (setq werr (whitespace-buffer))) |
| 811 | (if (and whitespace-abort-on-error werr) | 816 | (if (and whitespace-abort-on-error werr) |
| 812 | (error (concat "Abort write due to whitespaces in " | 817 | (error (concat "Abort write due to whitespaces in " |