annotate lisp/obsolete/old-whitespace.el @ 94000:ee22366f2a68

Add a comment giving version of obsolescence.
author Glenn Morris <rgm@gnu.org>
date Fri, 11 Apr 2008 07:44:49 +0000
parents 1662791e8fd8
children 43d30a1ea764
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88097
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
1 ;;; whitespace.el --- warn about and clean bogus whitespaces in the file
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
2
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
5
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
6 ;; Author: Rajesh Vaidheeswarran <rv@gnu.org>
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
7 ;; Keywords: convenience
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
8
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
10
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
14 ;; any later version.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
15
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
19 ;; GNU General Public License for more details.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
20
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
24 ;; Boston, MA 02110-1301, USA.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
25
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
26 ;;; Commentary:
94000
ee22366f2a68 Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents: 88097
diff changeset
27
ee22366f2a68 Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents: 88097
diff changeset
28 ;; This file has been obsolete since Emacs 23.1.
ee22366f2a68 Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents: 88097
diff changeset
29
88097
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
30 ;; URL: http://www.dsmit.com/lisp/
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
31 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
32 ;; The whitespace library is intended to find and help fix five different types
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
33 ;; of whitespace problems that commonly exist in source code.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
34 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
35 ;; 1. Leading space (empty lines at the top of a file).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
36 ;; 2. Trailing space (empty lines at the end of a file).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
37 ;; 3. Indentation space (8 or more spaces at beginning of line, that should be
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
38 ;; replaced with TABS).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
39 ;; 4. Spaces followed by a TAB. (Almost always, we never want that).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
40 ;; 5. Spaces or TABS at the end of a line.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
41 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
42 ;; Whitespace errors are reported in a buffer, and on the modeline.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
43 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
44 ;; Modeline will show a W:<x>!<y> to denote a particular type of whitespace,
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
45 ;; where `x' and `y' can be one (or more) of:
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
46 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
47 ;; e - End-of-Line whitespace.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
48 ;; i - Indentation whitespace.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
49 ;; l - Leading whitespace.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
50 ;; s - Space followed by Tab.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
51 ;; t - Trailing whitespace.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
52 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
53 ;; If any of the whitespace checks is turned off, the modeline will display a
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
54 ;; !<y>.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
55 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
56 ;; (since (3) is the most controversial one, here is the rationale: Most
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
57 ;; terminal drivers and printer drivers have TAB configured or even
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
58 ;; hardcoded to be 8 spaces. (Some of them allow configuration, but almost
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
59 ;; always they default to 8.)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
60 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
61 ;; Changing `tab-width' to other than 8 and editing will cause your code to
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
62 ;; look different from within Emacs, and say, if you cat it or more it, or
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
63 ;; even print it.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
64 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
65 ;; Almost all the popular programming modes let you define an offset (like
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
66 ;; c-basic-offset or perl-indent-level) to configure the offset, so you
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
67 ;; should never have to set your `tab-width' to be other than 8 in all
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
68 ;; these modes. In fact, with an indent level of say, 4, 2 TABS will cause
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
69 ;; Emacs to replace your 8 spaces with one \t (try it). If vi users in
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
70 ;; your office complain, tell them to use vim, which distinguishes between
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
71 ;; tabstop and shiftwidth (vi equivalent of our offsets), and also ask them
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
72 ;; to set smarttab.)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
73 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
74 ;; All the above have caused (and will cause) unwanted codeline integration and
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
75 ;; merge problems.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
76 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
77 ;; whitespace.el will complain if it detects whitespaces on opening a file, and
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
78 ;; warn you on closing a file also (in case you had inserted any
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
79 ;; whitespaces during the process of your editing).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
80 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
81 ;; Exported functions:
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
82 ;;
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
83 ;; `whitespace-buffer' - To check the current buffer for whitespace problems.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
84 ;; `whitespace-cleanup' - To cleanup all whitespaces in the current buffer.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
85 ;; `whitespace-region' - To check between point and mark for whitespace
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
86 ;; problems.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
87 ;; `whitespace-cleanup-region' - To cleanup all whitespaces between point
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
88 ;; and mark in the current buffer.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
89
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
90 ;;; Code:
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
91
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
92 (defvar whitespace-version "3.5" "Version of the whitespace library.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
93
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
94 (defvar whitespace-all-buffer-files nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
95 "An associated list of buffers and files checked for whitespace cleanliness.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
96
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
97 This is to enable periodic checking of whitespace cleanliness in the files
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
98 visited by the buffers.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
99
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
100 (defvar whitespace-rescan-timer nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
101 "Timer object used to rescan the files in buffers that have been modified.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
102
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
103 ;; Tell Emacs about this new kind of minor mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
104 (defvar whitespace-mode nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
105 "Non-nil when Whitespace mode (a minor mode) is enabled.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
106 (make-variable-buffer-local 'whitespace-mode)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
107
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
108 (defvar whitespace-mode-line nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
109 "String to display in the mode line for Whitespace mode.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
110 (make-variable-buffer-local 'whitespace-mode-line)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
111
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
112 (defvar whitespace-check-buffer-leading nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
113 "Test leading whitespace for file in current buffer if t.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
114 (make-variable-buffer-local 'whitespace-check-buffer-leading)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
115 ;;;###autoload(put 'whitespace-check-buffer-leading 'safe-local-variable 'booleanp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
116
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
117 (defvar whitespace-check-buffer-trailing nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
118 "Test trailing whitespace for file in current buffer if t.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
119 (make-variable-buffer-local 'whitespace-check-buffer-trailing)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
120 ;;;###autoload(put 'whitespace-check-buffer-trailing 'safe-local-variable 'booleanp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
121
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
122 (defvar whitespace-check-buffer-indent nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
123 "Test indentation whitespace for file in current buffer if t.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
124 (make-variable-buffer-local 'whitespace-check-buffer-indent)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
125 ;;;###autoload(put 'whitespace-check-buffer-indent 'safe-local-variable 'booleanp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
126
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
127 (defvar whitespace-check-buffer-spacetab nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
128 "Test Space-followed-by-TABS whitespace for file in current buffer if t.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
129 (make-variable-buffer-local 'whitespace-check-buffer-spacetab)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
130 ;;;###autoload(put 'whitespace-check-buffer-spacetab 'safe-local-variable 'booleanp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
131
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
132 (defvar whitespace-check-buffer-ateol nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
133 "Test end-of-line whitespace for file in current buffer if t.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
134 (make-variable-buffer-local 'whitespace-check-buffer-ateol)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
135 ;;;###autoload(put 'whitespace-check-buffer-ateol 'safe-local-variable 'booleanp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
136
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
137 (defvar whitespace-highlighted-space nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
138 "The variable to store the extent to highlight.")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
139 (make-variable-buffer-local 'whitespace-highlighted-space)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
140
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
141 (defalias 'whitespace-make-overlay
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
142 (if (featurep 'xemacs) 'make-extent 'make-overlay))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
143 (defalias 'whitespace-overlay-put
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
144 (if (featurep 'xemacs) 'set-extent-property 'overlay-put))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
145 (defalias 'whitespace-delete-overlay
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
146 (if (featurep 'xemacs) 'delete-extent 'delete-overlay))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
147 (defalias 'whitespace-overlay-start
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
148 (if (featurep 'xemacs) 'extent-start 'overlay-start))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
149 (defalias 'whitespace-overlay-end
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
150 (if (featurep 'xemacs) 'extent-end 'overlay-end))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
151 (defalias 'whitespace-mode-line-update
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
152 (if (featurep 'xemacs) 'redraw-modeline 'force-mode-line-update))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
153
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
154 (defgroup whitespace nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
155 "Check for and fix five different types of whitespaces in source code."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
156 :version "21.1"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
157 :link '(emacs-commentary-link "whitespace.el")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
158 ;; Since XEmacs doesn't have a 'convenience group, use the next best group
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
159 ;; which is 'editing?
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
160 :group (if (featurep 'xemacs) 'editing 'convenience))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
161
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
162 (defcustom whitespace-check-leading-whitespace t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
163 "Flag to check leading whitespace. This is the global for the system.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
164 It can be overridden by setting a buffer local variable
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
165 `whitespace-check-buffer-leading'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
166 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
167 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
168
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
169 (defcustom whitespace-check-trailing-whitespace t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
170 "Flag to check trailing whitespace. This is the global for the system.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
171 It can be overridden by setting a buffer local variable
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
172 `whitespace-check-buffer-trailing'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
173 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
174 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
175
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
176 (defcustom whitespace-check-spacetab-whitespace t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
177 "Flag to check space followed by a TAB. This is the global for the system.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
178 It can be overridden by setting a buffer local variable
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
179 `whitespace-check-buffer-spacetab'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
180 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
181 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
182
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
183 (defcustom whitespace-spacetab-regexp "[ ]+\t"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
184 "Regexp to match one or more spaces followed by a TAB."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
185 :type 'regexp
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
186 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
187
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
188 (defcustom whitespace-check-indent-whitespace indent-tabs-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
189 "Flag to check indentation whitespace. This is the global for the system.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
190 It can be overridden by setting a buffer local variable
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
191 `whitespace-check-buffer-indent'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
192 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
193 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
194
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
195 (defcustom whitespace-indent-regexp "^\t*\\( \\)+"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
196 "Regexp to match multiples of eight spaces near line beginnings.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
197 The default value ignores leading TABs."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
198 :type 'regexp
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
199 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
200
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
201 (defcustom whitespace-check-ateol-whitespace t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
202 "Flag to check end-of-line whitespace. This is the global for the system.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
203 It can be overridden by setting a buffer local variable
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
204 `whitespace-check-buffer-ateol'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
205 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
206 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
207
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
208 (defcustom whitespace-ateol-regexp "[ \t]+$"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
209 "Regexp to match one or more TABs or spaces at line ends."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
210 :type 'regexp
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
211 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
212
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
213 (defcustom whitespace-errbuf "*Whitespace Errors*"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
214 "The name of the buffer where whitespace related messages will be logged."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
215 :type 'string
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
216 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
217
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
218 (defcustom whitespace-clean-msg "clean."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
219 "If non-nil, this message will be displayed after a whitespace check
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
220 determines a file to be clean."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
221 :type 'string
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
222 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
223
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
224 (defcustom whitespace-abort-on-error nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
225 "While writing a file, abort if the file is unclean.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
226 If `whitespace-auto-cleanup' is set, that takes precedence over
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
227 this variable."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
228 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
229 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
230
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
231 (defcustom whitespace-auto-cleanup nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
232 "Cleanup a buffer automatically on finding it whitespace unclean."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
233 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
234 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
235
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
236 (defcustom whitespace-silent nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
237 "All whitespace errors will be shown only in the modeline when t.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
238
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
239 Note that setting this may cause all whitespaces introduced in a file to go
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
240 unnoticed when the buffer is killed, unless the user visits the `*Whitespace
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
241 Errors*' buffer before opening (or closing) another file."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
242 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
243 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
244
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
245 (defcustom whitespace-modes '(ada-mode asm-mode autoconf-mode awk-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
246 c-mode c++-mode cc-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
247 change-log-mode cperl-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
248 electric-nroff-mode emacs-lisp-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
249 f90-mode fortran-mode html-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
250 html3-mode java-mode jde-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
251 ksh-mode latex-mode LaTeX-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
252 lisp-mode m4-mode makefile-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
253 modula-2-mode nroff-mode objc-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
254 pascal-mode perl-mode prolog-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
255 python-mode scheme-mode sgml-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
256 sh-mode shell-script-mode simula-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
257 tcl-mode tex-mode texinfo-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
258 vrml-mode xml-mode)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
259
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
260 "Major modes in which we turn on whitespace checking.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
261
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
262 These are mostly programming and documentation modes. But you may add other
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
263 modes that you want whitespaces checked in by adding something like the
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
264 following to your `.emacs':
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
265
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
266 \(setq whitespace-modes (cons 'my-mode (cons 'my-other-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
267 whitespace-modes))\)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
268
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
269 Or, alternately, you can use the Emacs `customize' command to set this."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
270 :type '(repeat symbol)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
271 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
272
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
273 (defcustom whitespace-rescan-timer-time 600
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
274 "Period in seconds to rescan modified buffers for whitespace creep.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
275
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
276 This is the period after which the timer will fire causing
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
277 `whitespace-rescan-files-in-buffers' to check for whitespace creep in
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
278 modified buffers.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
279
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
280 To disable timer scans, set this to zero."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
281 :type 'integer
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
282 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
283
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
284 (defcustom whitespace-display-in-modeline t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
285 "Display whitespace errors on the modeline."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
286 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
287 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
288
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
289 (defcustom whitespace-display-spaces-in-color t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
290 "Display the bogus whitespaces by coloring them with the face
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
291 `whitespace-highlight'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
292 :type 'boolean
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
293 :group 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
294
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
295 (defgroup whitespace-faces nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
296 "Faces used in whitespace."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
297 :prefix "whitespace-"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
298 :group 'whitespace
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
299 :group 'faces)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
300
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
301 (defface whitespace-highlight '((((class color) (background light))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
302 (:background "green1"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
303 (((class color) (background dark))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
304 (:background "sea green"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
305 (((class grayscale mono)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
306 (background light))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
307 (:background "black"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
308 (((class grayscale mono)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
309 (background dark))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
310 (:background "white")))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
311 "Face used for highlighting the bogus whitespaces that exist in the buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
312 :group 'whitespace-faces)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
313 ;; backward-compatibility alias
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
314 (put 'whitespace-highlight-face 'face-alias 'whitespace-highlight)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
315
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
316 (if (not (assoc 'whitespace-mode minor-mode-alist))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
317 (setq minor-mode-alist (cons '(whitespace-mode whitespace-mode-line)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
318 minor-mode-alist)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
319
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
320 (set-default 'whitespace-check-buffer-leading
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
321 whitespace-check-leading-whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
322 (set-default 'whitespace-check-buffer-trailing
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
323 whitespace-check-trailing-whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
324 (set-default 'whitespace-check-buffer-indent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
325 whitespace-check-indent-whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
326 (set-default 'whitespace-check-buffer-spacetab
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
327 whitespace-check-spacetab-whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
328 (set-default 'whitespace-check-buffer-ateol
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
329 whitespace-check-ateol-whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
330
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
331 (defun whitespace-check-whitespace-mode (&optional arg)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
332 "Test and set the whitespace-mode in qualifying buffers."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
333 (if (null whitespace-mode)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
334 (setq whitespace-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
335 (if (or arg (member major-mode whitespace-modes))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
336 t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
337 nil))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
338
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
339 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
340 (defun whitespace-toggle-leading-check ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
341 "Toggle the check for leading space in the local buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
342 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
343 (let ((current-val whitespace-check-buffer-leading))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
344 (setq whitespace-check-buffer-leading (not current-val))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
345 (message "Will%s check for leading space in buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
346 (if whitespace-check-buffer-leading "" " not"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
347 (if whitespace-check-buffer-leading (whitespace-buffer-leading))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
348
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
349 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
350 (defun whitespace-toggle-trailing-check ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
351 "Toggle the check for trailing space in the local buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
352 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
353 (let ((current-val whitespace-check-buffer-trailing))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
354 (setq whitespace-check-buffer-trailing (not current-val))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
355 (message "Will%s check for trailing space in buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
356 (if whitespace-check-buffer-trailing "" " not"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
357 (if whitespace-check-buffer-trailing (whitespace-buffer-trailing))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
358
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
359 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
360 (defun whitespace-toggle-indent-check ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
361 "Toggle the check for indentation space in the local buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
362 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
363 (let ((current-val whitespace-check-buffer-indent))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
364 (setq whitespace-check-buffer-indent (not current-val))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
365 (message "Will%s check for indentation space in buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
366 (if whitespace-check-buffer-indent "" " not"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
367 (if whitespace-check-buffer-indent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
368 (whitespace-buffer-search whitespace-indent-regexp))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
369
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
370 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
371 (defun whitespace-toggle-spacetab-check ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
372 "Toggle the check for space-followed-by-TABs in the local buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
373 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
374 (let ((current-val whitespace-check-buffer-spacetab))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
375 (setq whitespace-check-buffer-spacetab (not current-val))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
376 (message "Will%s check for space-followed-by-TABs in buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
377 (if whitespace-check-buffer-spacetab "" " not"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
378 (if whitespace-check-buffer-spacetab
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
379 (whitespace-buffer-search whitespace-spacetab-regexp))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
380
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
381
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
382 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
383 (defun whitespace-toggle-ateol-check ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
384 "Toggle the check for end-of-line space in the local buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
385 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
386 (let ((current-val whitespace-check-buffer-ateol))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
387 (setq whitespace-check-buffer-ateol (not current-val))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
388 (message "Will%s check for end-of-line space in buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
389 (if whitespace-check-buffer-ateol "" " not"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
390 (if whitespace-check-buffer-ateol
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
391 (whitespace-buffer-search whitespace-ateol-regexp))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
392
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
393
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
394 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
395 (defun whitespace-buffer (&optional quiet)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
396 "Find five different types of white spaces in buffer.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
397 These are:
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
398 1. Leading space \(empty lines at the top of a file\).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
399 2. Trailing space \(empty lines at the end of a file\).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
400 3. Indentation space \(8 or more spaces, that should be replaced with TABS\).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
401 4. Spaces followed by a TAB. \(Almost always, we never want that\).
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
402 5. Spaces or TABS at the end of a line.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
403
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
404 Check for whitespace only if this buffer really contains a non-empty file
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
405 and:
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
406 1. the major mode is one of the whitespace-modes, or
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
407 2. `whitespace-buffer' was explicitly called with a prefix argument."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
408 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
409 (let ((whitespace-error nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
410 (whitespace-check-whitespace-mode current-prefix-arg)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
411 (if (and buffer-file-name (> (buffer-size) 0) whitespace-mode)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
412 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
413 (whitespace-check-buffer-list (buffer-name) buffer-file-name)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
414 (whitespace-tickle-timer)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
415 (overlay-recenter (point-max))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
416 (remove-overlays nil nil 'face 'whitespace-highlight)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
417 (if whitespace-auto-cleanup
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
418 (if buffer-read-only
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
419 (if (not quiet)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
420 (message "Can't cleanup: %s is read-only" (buffer-name)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
421 (whitespace-cleanup-internal))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
422 (let ((whitespace-leading (if whitespace-check-buffer-leading
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
423 (whitespace-buffer-leading)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
424 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
425 (whitespace-trailing (if whitespace-check-buffer-trailing
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
426 (whitespace-buffer-trailing)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
427 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
428 (whitespace-indent (if whitespace-check-buffer-indent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
429 (whitespace-buffer-search
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
430 whitespace-indent-regexp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
431 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
432 (whitespace-spacetab (if whitespace-check-buffer-spacetab
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
433 (whitespace-buffer-search
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
434 whitespace-spacetab-regexp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
435 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
436 (whitespace-ateol (if whitespace-check-buffer-ateol
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
437 (whitespace-buffer-search
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
438 whitespace-ateol-regexp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
439 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
440 (whitespace-errmsg nil)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
441 (whitespace-filename buffer-file-name)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
442 (whitespace-this-modeline ""))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
443
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
444 ;; Now let's complain if we found any of the above.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
445 (setq whitespace-error (or whitespace-leading whitespace-indent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
446 whitespace-spacetab whitespace-ateol
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
447 whitespace-trailing))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
448
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
449 (if whitespace-error
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
450 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
451 (setq whitespace-errmsg
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
452 (concat whitespace-filename " contains:\n"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
453 (if whitespace-leading
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
454 "Leading whitespace\n")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
455 (if whitespace-indent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
456 (concat "Indentation whitespace"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
457 whitespace-indent "\n"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
458 (if whitespace-spacetab
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
459 (concat "Space followed by Tab"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
460 whitespace-spacetab "\n"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
461 (if whitespace-ateol
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
462 (concat "End-of-line whitespace"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
463 whitespace-ateol "\n"))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
464 (if whitespace-trailing
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
465 "Trailing whitespace\n")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
466 "\ntype `M-x whitespace-cleanup' to "
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
467 "cleanup the file."))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
468 (setq whitespace-this-modeline
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
469 (concat (if whitespace-ateol "e")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
470 (if whitespace-indent "i")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
471 (if whitespace-leading "l")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
472 (if whitespace-spacetab "s")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
473 (if whitespace-trailing "t")))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
474 (whitespace-update-modeline whitespace-this-modeline)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
475 (if (get-buffer whitespace-errbuf)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
476 (kill-buffer whitespace-errbuf))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
477 (with-current-buffer (get-buffer-create whitespace-errbuf)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
478 (if whitespace-errmsg
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
479 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
480 (insert whitespace-errmsg)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
481 (if (not (or quiet whitespace-silent))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
482 (display-buffer (current-buffer) t))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
483 (if (not quiet)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
484 (message "Whitespaces: [%s%s] in %s"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
485 whitespace-this-modeline
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
486 (let ((whitespace-unchecked
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
487 (whitespace-unchecked-whitespaces)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
488 (if whitespace-unchecked
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
489 (concat "!" whitespace-unchecked)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
490 ""))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
491 whitespace-filename)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
492 (if (and (not quiet) (not (equal whitespace-clean-msg "")))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
493 (message "%s %s" whitespace-filename
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
494 whitespace-clean-msg))))))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
495 whitespace-error))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
496
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
497 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
498 (defun whitespace-region (s e)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
499 "Check the region for whitespace errors."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
500 (interactive "r")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
501 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
502 (save-restriction
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
503 (narrow-to-region s e)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
504 (whitespace-buffer))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
505
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
506 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
507 (defun whitespace-cleanup ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
508 "Cleanup the five different kinds of whitespace problems.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
509 It normally applies to the whole buffer, but in Transient Mark mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
510 when the mark is active it applies to the region.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
511 See `whitespace-buffer' docstring for a summary of the problems."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
512 (interactive)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
513 (if (and transient-mark-mode mark-active)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
514 (whitespace-cleanup-region (region-beginning) (region-end))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
515 (whitespace-cleanup-internal)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
516
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
517 (defun whitespace-cleanup-internal (&optional region-only)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
518 ;; If this buffer really contains a file, then run, else quit.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
519 (whitespace-check-whitespace-mode current-prefix-arg)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
520 (if (and buffer-file-name whitespace-mode)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
521 (let ((whitespace-any nil)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
522 (whitespace-tabwith 8)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
523 (whitespace-tabwith-saved tab-width))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
524
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
525 ;; since all printable TABS should be 8, irrespective of how
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
526 ;; they are displayed.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
527 (setq tab-width whitespace-tabwith)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
528
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
529 (if (and whitespace-check-buffer-leading
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
530 (whitespace-buffer-leading))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
531 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
532 (whitespace-buffer-leading-cleanup)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
533 (setq whitespace-any t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
534
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
535 (if (and whitespace-check-buffer-trailing
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
536 (whitespace-buffer-trailing))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
537 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
538 (whitespace-buffer-trailing-cleanup)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
539 (setq whitespace-any t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
540
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
541 (if (and whitespace-check-buffer-indent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
542 (whitespace-buffer-search whitespace-indent-regexp))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
543 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
544 (whitespace-indent-cleanup)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
545 (setq whitespace-any t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
546
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
547 (if (and whitespace-check-buffer-spacetab
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
548 (whitespace-buffer-search whitespace-spacetab-regexp))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
549 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
550 (whitespace-buffer-cleanup whitespace-spacetab-regexp "\t")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
551 (setq whitespace-any t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
552
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
553 (if (and whitespace-check-buffer-ateol
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
554 (whitespace-buffer-search whitespace-ateol-regexp))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
555 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
556 (whitespace-buffer-cleanup whitespace-ateol-regexp "")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
557 (setq whitespace-any t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
558
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
559 ;; Call this recursively till everything is taken care of
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
560 (if whitespace-any
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
561 (whitespace-cleanup-internal region-only)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
562 ;; if we are done, talk to the user
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
563 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
564 (unless whitespace-silent
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
565 (if region-only
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
566 (message "The region is now clean")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
567 (message "%s is now clean" buffer-file-name)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
568 (whitespace-update-modeline)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
569 (setq tab-width whitespace-tabwith-saved))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
570
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
571 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
572 (defun whitespace-cleanup-region (s e)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
573 "Whitespace cleanup on the region."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
574 (interactive "r")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
575 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
576 (save-restriction
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
577 (narrow-to-region s e)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
578 (whitespace-cleanup-internal t))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
579 (whitespace-buffer t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
580
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
581 (defun whitespace-buffer-leading ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
582 "Return t if the current buffer has leading newline characters.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
583 If highlighting is enabled, highlight these characters."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
584 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
585 (goto-char (point-min))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
586 (skip-chars-forward "\n")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
587 (unless (bobp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
588 (whitespace-highlight-the-space (point-min) (point))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
589 t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
590
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
591 (defun whitespace-buffer-leading-cleanup ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
592 "Remove any leading newline characters from current buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
593 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
594 (goto-char (point-min))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
595 (skip-chars-forward "\n")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
596 (delete-region (point-min) (point))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
597
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
598 (defun whitespace-buffer-trailing ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
599 "Return t if the current buffer has extra trailing newline characters.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
600 If highlighting is enabled, highlight these characters."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
601 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
602 (goto-char (point-max))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
603 (skip-chars-backward "\n")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
604 (forward-line)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
605 (unless (eobp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
606 (whitespace-highlight-the-space (point) (point-max))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
607 t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
608
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
609 (defun whitespace-buffer-trailing-cleanup ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
610 "Remove extra trailing newline characters from current buffer."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
611 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
612 (goto-char (point-max))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
613 (skip-chars-backward "\n")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
614 (unless (eobp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
615 (forward-line)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
616 (delete-region (point) (point-max)))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
617
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
618 (defun whitespace-buffer-search (regexp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
619 "Search for any given whitespace REGEXP."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
620 (with-local-quit
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
621 (let (whitespace-retval)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
622 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
623 (goto-char (point-min))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
624 (while (re-search-forward regexp nil t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
625 (whitespace-highlight-the-space (match-beginning 0) (match-end 0))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
626 (push (match-beginning 0) whitespace-retval)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
627 (when whitespace-retval
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
628 (format " %s" (nreverse whitespace-retval))))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
629
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
630 (defun whitespace-buffer-cleanup (regexp newregexp)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
631 "Search for any given whitespace REGEXP and replace it with the NEWREGEXP."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
632 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
633 (goto-char (point-min))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
634 (while (re-search-forward regexp nil t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
635 (replace-match newregexp))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
636
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
637 (defun whitespace-indent-cleanup ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
638 "Search for 8/more spaces at the start of a line and replace it with tabs."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
639 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
640 (goto-char (point-min))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
641 (while (re-search-forward whitespace-indent-regexp nil t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
642 (let ((column (current-column))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
643 (indent-tabs-mode t))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
644 (delete-region (match-beginning 0) (point))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
645 (indent-to column)))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
646
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
647 (defun whitespace-unchecked-whitespaces ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
648 "Return the list of whitespaces whose testing has been suppressed."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
649 (let ((unchecked-spaces
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
650 (concat (if (not whitespace-check-buffer-ateol) "e")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
651 (if (not whitespace-check-buffer-indent) "i")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
652 (if (not whitespace-check-buffer-leading) "l")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
653 (if (not whitespace-check-buffer-spacetab) "s")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
654 (if (not whitespace-check-buffer-trailing) "t"))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
655 (if (not (equal unchecked-spaces ""))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
656 unchecked-spaces
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
657 nil)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
658
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
659 (defun whitespace-update-modeline (&optional whitespace-err)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
660 "Update modeline with whitespace errors.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
661 Also with whitespaces whose testing has been turned off."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
662 (if whitespace-display-in-modeline
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
663 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
664 (setq whitespace-mode-line nil)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
665 ;; Whitespace errors
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
666 (if (and whitespace-err (not (equal whitespace-err "")))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
667 (setq whitespace-mode-line whitespace-err))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
668 ;; Whitespace suppressed errors
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
669 (let ((whitespace-unchecked (whitespace-unchecked-whitespaces)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
670 (if whitespace-unchecked
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
671 (setq whitespace-mode-line
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
672 (concat whitespace-mode-line "!" whitespace-unchecked))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
673 ;; Add the whitespace modeline prefix
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
674 (setq whitespace-mode-line (if whitespace-mode-line
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
675 (concat " W:" whitespace-mode-line)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
676 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
677 (whitespace-mode-line-update))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
678
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
679 (defun whitespace-highlight-the-space (b e)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
680 "Highlight the current line, unhighlighting a previously jumped to line."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
681 (if whitespace-display-spaces-in-color
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
682 (let ((ol (whitespace-make-overlay b e)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
683 (whitespace-overlay-put ol 'face 'whitespace-highlight))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
684
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
685 (defun whitespace-unhighlight-the-space()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
686 "Unhighlight the currently highlight line."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
687 (if (and whitespace-display-spaces-in-color whitespace-highlighted-space)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
688 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
689 (mapc 'whitespace-delete-overlay whitespace-highlighted-space)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
690 (setq whitespace-highlighted-space nil))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
691
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
692 (defun whitespace-check-buffer-list (buf-name buf-file)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
693 "Add a buffer and its file to the whitespace monitor list.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
694
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
695 The buffer named BUF-NAME and its associated file BUF-FILE are now monitored
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
696 periodically for whitespace."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
697 (if (and whitespace-mode (not (member (list buf-file buf-name)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
698 whitespace-all-buffer-files)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
699 (add-to-list 'whitespace-all-buffer-files (list buf-file buf-name))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
700
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
701 (defun whitespace-tickle-timer ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
702 "Tickle timer to periodically to scan qualifying files for whitespace creep.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
703
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
704 If timer is not set, then set it to scan the files in
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
705 `whitespace-all-buffer-files' periodically (defined by
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
706 `whitespace-rescan-timer-time') for whitespace creep."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
707 (if (and whitespace-rescan-timer-time
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
708 (/= whitespace-rescan-timer-time 0)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
709 (not whitespace-rescan-timer))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
710 (setq whitespace-rescan-timer
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
711 (add-timeout whitespace-rescan-timer-time
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
712 'whitespace-rescan-files-in-buffers nil
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
713 whitespace-rescan-timer-time))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
714
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
715 (defun whitespace-rescan-files-in-buffers (&optional arg)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
716 "Check monitored files for whitespace creep since last scan."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
717 (let ((whitespace-all-my-files whitespace-all-buffer-files)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
718 buffile bufname thiselt buf)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
719 (if (not whitespace-all-my-files)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
720 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
721 (disable-timeout whitespace-rescan-timer)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
722 (setq whitespace-rescan-timer nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
723 (while whitespace-all-my-files
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
724 (setq thiselt (car whitespace-all-my-files))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
725 (setq whitespace-all-my-files (cdr whitespace-all-my-files))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
726 (setq buffile (car thiselt))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
727 (setq bufname (cadr thiselt))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
728 (setq buf (get-buffer bufname))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
729 (if (buffer-live-p buf)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
730 (save-excursion
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
731 ;;(message "buffer %s live" bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
732 (set-buffer bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
733 (if whitespace-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
734 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
735 ;;(message "checking for whitespace in %s" bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
736 (if whitespace-auto-cleanup
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
737 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
738 ;;(message "cleaning up whitespace in %s" bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
739 (whitespace-cleanup-internal))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
740 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
741 ;;(message "whitespace-buffer %s." (buffer-name))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
742 (whitespace-buffer t))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
743 ;;(message "Removing %s from refresh list" bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
744 (whitespace-refresh-rescan-list buffile bufname)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
745 ;;(message "Removing %s from refresh list" bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
746 (whitespace-refresh-rescan-list buffile bufname))))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
747
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
748 (defun whitespace-refresh-rescan-list (buffile bufname)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
749 "Refresh the list of files to be rescanned for whitespace creep."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
750 (if whitespace-all-buffer-files
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
751 (setq whitespace-all-buffer-files
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
752 (delete (list buffile bufname) whitespace-all-buffer-files))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
753 (when whitespace-rescan-timer
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
754 (disable-timeout whitespace-rescan-timer)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
755 (setq whitespace-rescan-timer nil))))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
756
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
757 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
758 (defalias 'global-whitespace-mode 'whitespace-global-mode)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
759
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
760 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
761 (define-minor-mode whitespace-global-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
762 "Toggle using Whitespace mode in new buffers.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
763 With ARG, turn the mode on if ARG is positive, otherwise turn it off.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
764
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
765 When this mode is active, `whitespace-buffer' is added to
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
766 `find-file-hook' and `kill-buffer-hook'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
767 :global t
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
768 :group 'whitespace
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
769 (if whitespace-global-mode
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
770 (progn
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
771 (add-hook 'find-file-hook 'whitespace-buffer)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
772 (add-hook 'write-file-functions 'whitespace-write-file-hook nil t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
773 (add-hook 'kill-buffer-hook 'whitespace-buffer))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
774 (remove-hook 'find-file-hook 'whitespace-buffer)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
775 (remove-hook 'write-file-functions 'whitespace-write-file-hook t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
776 (remove-hook 'kill-buffer-hook 'whitespace-buffer)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
777
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
778 ;;;###autoload
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
779 (defun whitespace-write-file-hook ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
780 "Hook function to be called on the buffer when whitespace check is enabled.
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
781 This is meant to be added buffer-locally to `write-file-functions'."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
782 (let ((werr nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
783 (if whitespace-auto-cleanup
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
784 (whitespace-cleanup-internal)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
785 (setq werr (whitespace-buffer)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
786 (if (and whitespace-abort-on-error werr)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
787 (error "Abort write due to whitespaces in %s"
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
788 buffer-file-name)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
789 nil)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
790
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
791 (defun whitespace-unload-function ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
792 "Unload the whitespace library."
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
793 (if (unintern "whitespace-unload-hook")
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
794 ;; if whitespace-unload-hook is defined, let's get rid of it
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
795 ;; and recursively call `unload-feature'
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
796 (progn (unload-feature 'whitespace) t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
797 ;; this only happens in the recursive call
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
798 (whitespace-global-mode -1)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
799 (save-current-buffer
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
800 (dolist (buf (buffer-list))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
801 (set-buffer buf)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
802 (remove-hook 'write-file-functions 'whitespace-write-file-hook t)))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
803 ;; continue standard unloading
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
804 nil))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
805
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
806 (defun whitespace-unload-hook ()
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
807 (remove-hook 'find-file-hook 'whitespace-buffer)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
808 (remove-hook 'write-file-functions 'whitespace-write-file-hook t)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
809 (remove-hook 'kill-buffer-hook 'whitespace-buffer))
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
810
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
811 (add-hook 'whitespace-unload-hook 'whitespace-unload-hook)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
812
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
813 (provide 'whitespace)
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
814
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
815 ;; arch-tag: 4ff44e87-b63c-402d-95a6-15e51e58bd0c
1662791e8fd8 Rename blank-mode.el to whitespace.el and obsolete/whitespace.el to obsolete/old-whitespace.el
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff changeset
816 ;;; whitespace.el ends here