diff options
| author | Rajesh Vaidheeswarran | 2006-05-25 18:09:25 +0000 |
|---|---|---|
| committer | Rajesh Vaidheeswarran | 2006-05-25 18:09:25 +0000 |
| commit | f473c8d5af209f42c30bd32f34c466d8d85e1585 (patch) | |
| tree | 8e2abf6dd62f24f5ca6de4cb2f5ade6f995baf14 | |
| parent | 403a7bca0afb21612c60b4d26f909af2bb68b159 (diff) | |
| download | emacs-f473c8d5af209f42c30bd32f34c466d8d85e1585.tar.gz emacs-f473c8d5af209f42c30bd32f34c466d8d85e1585.zip | |
whitespace.el - make whitesspace-cleanup use the current active regoin, if there is one.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/whitespace.el | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8daed2b8801..c36c59b1228 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2006-05-25 Rajesh Vaidheeswarran <rv@gnu.org> | ||
| 2 | * whitespace.el (whitespace-cleanup): change to cleanup | ||
| 3 | region if one is active | ||
| 4 | * whitespace.el (whitespace-cleanup-internal): new internal | ||
| 5 | method | ||
| 6 | |||
| 1 | 2006-05-25 Mathias Dahl <mathias.dahl@gmail.com> | 7 | 2006-05-25 Mathias Dahl <mathias.dahl@gmail.com> |
| 2 | 8 | ||
| 3 | * dired.el (dired-mode-map): Add help-echo strings to tumme | 9 | * dired.el (dired-mode-map): Add help-echo strings to tumme |
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 " |