Mercurial > emacs
comparison lisp/whitespace.el @ 83530:46b1096093f5
Merged from emacs@sv.gnu.org.
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-294
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-295
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-296
Update from CVS: admin/FOR-RELEASE: Update refcard section.
* emacs@sv.gnu.org/emacs--devo--0--patch-297
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-298
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-299
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-300
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-301
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-302
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-303
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-304
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-103
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-104
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 12 Jun 2006 07:27:12 +0000 |
parents | b98066f4aa10 1d492927a08d |
children | 694bbb62a75d |
comparison
equal
deleted
inserted
replaced
83529:0d9e16eab053 | 83530:46b1096093f5 |
---|---|
428 (whitespace-unhighlight-the-space) | 428 (whitespace-unhighlight-the-space) |
429 (if whitespace-auto-cleanup | 429 (if whitespace-auto-cleanup |
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)) |
437 (whitespace-trailing (if whitespace-check-buffer-trailing | 437 (whitespace-trailing (if whitespace-check-buffer-trailing |
438 (whitespace-buffer-trailing) | 438 (whitespace-buffer-trailing) |
518 ;;;###autoload | 518 ;;;###autoload |
519 (defun whitespace-cleanup () | 519 (defun whitespace-cleanup () |
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) |
526 (let ((whitespace-any nil) | 531 (let ((whitespace-any nil) |
527 (whitespace-tabwith 8) | 532 (whitespace-tabwith 8) |
561 (whitespace-buffer-cleanup whitespace-ateol-regexp "") | 566 (whitespace-buffer-cleanup whitespace-ateol-regexp "") |
562 (setq whitespace-any t))) | 567 (setq whitespace-any t))) |
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)) |
570 (whitespace-update-modeline))) | 575 (whitespace-update-modeline))) |
571 (setq tab-width whitespace-tabwith-saved)))) | 576 (setq tab-width whitespace-tabwith-saved)))) |
575 "Whitespace cleanup on the region." | 580 "Whitespace cleanup on the region." |
576 (interactive "r") | 581 (interactive "r") |
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 () |
584 "Check to see if there are any empty lines at the top of the file." | 589 "Check to see if there are any empty lines at the top of the file." |
585 (save-excursion | 590 (save-excursion |
758 (progn | 763 (progn |
759 ;;(message "checking for whitespace in %s" bufname) | 764 ;;(message "checking for whitespace in %s" bufname) |
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)))) |
767 ;;(message "Removing %s from refresh list" bufname) | 772 ;;(message "Removing %s from refresh list" bufname) |
768 (whitespace-refresh-rescan-list buffile bufname))) | 773 (whitespace-refresh-rescan-list buffile bufname))) |
804 "Hook function to be called on the buffer when whitespace check is enabled. | 809 "Hook function to be called on the buffer when whitespace check is enabled. |
805 This is meant to be added buffer-locally to `write-file-functions'." | 810 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 " |
813 buffer-file-name)))) | 818 buffer-file-name)))) |
814 nil) | 819 nil) |