(cwarn) <defgroup>: Add :version, :link.
[emacs.git] / lisp / whitespace.el
blob5944f270c8e9ee8c313a50c5eca9422d95ba7ed4
1 ;;; whitespace.el --- Warn about and clean bogus whitespaces in the file.
3 ;; Copyright (C) 1999-2000 Free Software Foundation, Inc.
5 ;; Author: Rajesh Vaidheeswarran <rv@gnu.org>
6 ;; Keywords: convenience
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Commentary:
27 ;; Whitespace.el URL: http://www.dsmit.com/lisp/
29 ;; Exported functions:
31 ;; `whitespace-buffer' - To check the current buffer for whitespace problems.
32 ;; `whitespace-cleanup' - To cleanup all whitespaces in the current buffer.
33 ;; `whitespace-region' - To check between point and mark for whitespace
34 ;; problems.
35 ;; `whitespace-cleanup-region' - To cleanup all whitespaces between point
36 ;; and mark in the current buffer.
37 ;; `whitespace-describe' - A simple introduction to the library.
39 ;;; Code:
41 ;; add a hook to find-file-hooks and kill-buffer-hook
42 (add-hook 'find-file-hooks 'whitespace-buffer)
43 (add-hook 'kill-buffer-hook 'whitespace-buffer)
45 (defvar whitespace-version "2.8" "Version of the whitespace library.")
46 ;; Find out what type of Emacs we are running in.
47 (defvar whitespace-running-emacs (if (string-match "XEmacs\\|Lucid"
48 emacs-version) nil t)
49 "If this is Emacs, not XEmacs, this is t.")
51 (if whitespace-running-emacs (require 'timer))
53 (defvar whitespace-all-buffer-files nil
54 "An associated list of buffers and files checked for whitespace cleanliness.
56 This is to enable periodic checking of whitespace cleanliness in the files
57 visited by the buffers.")
59 (defvar whitespace-rescan-timer nil
60 "Timer object used to rescan the files in buffers that have been modified.")
62 ;; Tell Emacs about this new kind of minor mode
63 (defvar whitespace-mode nil
64 "Non-nil when Whitespace mode (a minor mode) is enabled.")
65 (make-variable-buffer-local 'whitespace-mode)
66 (put 'whitespace-mode 'permanent-local nil)
68 (defvar whitespace-mode-line nil
69 "String to display in the mode line for Whitespace mode.")
70 (make-variable-buffer-local 'whitespace-mode-line)
71 (put 'whitespace-mode-line 'permanent-local nil)
73 ;; For flavors of Emacs which don't define `defgroup' and `defcustom'.
74 (eval-when-compile
75 (if (not (fboundp 'defgroup))
76 (defmacro defgroup (sym memb doc &rest args)
77 "Null macro for defgroup in all versions of Emacs that don't define
78 defgroup"
79 t))
80 (if (not (fboundp 'defcustom))
81 (defmacro defcustom (sym val doc &rest args)
82 "Macro to alias defcustom to defvar in all versions of Emacs that
83 don't define defcustom"
84 `(defvar ,sym ,val ,doc))))
86 (defgroup whitespace nil
87 "Check for and fix five different types of whitespaces in source code."
88 ;; Since XEmacs doesn't have a 'convenience group, use the next best group
89 ;; which is 'editing?
90 ;; :version "21.1"
91 :group (if whitespace-running-emacs 'convenience 'editing))
93 (defcustom whitespace-check-leading-whitespace t
94 "Flag to check leading whitespace."
95 :type 'boolean
96 :group 'whitespace)
98 (defcustom whitespace-check-trailing-whitespace t
99 "Flag to check trailing whitespace."
100 :type 'boolean
101 :group 'whitespace)
103 (defcustom whitespace-check-spacetab-whitespace t
104 "Flag to check space followed by a TAB."
105 :type 'boolean
106 :group 'whitespace)
108 (defcustom whitespace-spacetab-regexp " \t"
109 "Regexp to match a space followed by a TAB."
110 :type 'string
111 :group 'whitespace)
113 (defcustom whitespace-check-indent-whitespace t
114 "Flag to check indentation whitespace."
115 :type 'boolean
116 :group 'whitespace)
118 (defcustom whitespace-indent-regexp (concat "^\\(\t*\\) " " ")
119 "Regexp to match (any TABS followed by) 8/more whitespaces at start of line."
120 :type 'string
121 :group 'whitespace)
123 (defcustom whitespace-check-ateol-whitespace t
124 "Flag to check end-of-line whitespace."
125 :type 'boolean
126 :group 'whitespace)
128 (defcustom whitespace-ateol-regexp "[ \t]$"
129 "Regexp to match a TAB or a space at the EOL."
130 :type 'string
131 :group 'whitespace)
133 (defcustom whitespace-errbuf "*Whitespace Errors*"
134 "The buffer where whitespace related messages will be logged."
135 :type 'string
136 :group 'whitespace)
138 (defcustom whitespace-auto-cleanup nil
139 "Cleanup a buffer automatically on finding it whitespace unclean."
140 :type 'boolean
141 :group 'whitespace)
143 (defcustom whitespace-silent nil
144 "All whitespace errors will be shown only in the modeline when t.
146 Note that setting this may cause all whitespaces introduced in a file to go
147 unnoticed when the buffer is killed, unless the user visits the `*Whitespace
148 Errors*' buffer before opening (or closing) another file."
149 :type 'boolean
150 :group 'whitespace)
152 (defcustom whitespace-modes '(ada-mode asm-mode autoconf-mode awk-mode
153 c-mode c++-mode cc-mode
154 change-log-mode cperl-mode
155 electric-nroff-mode emacs-lisp-mode
156 f90-mode fortran-mode html-mode
157 html3-mode java-mode jde-mode
158 ksh-mode latex-mode LaTeX-mode
159 lisp-mode m4-mode makefile-mode
160 modula-2-mode nroff-mode objc-mode
161 pascal-mode perl-mode prolog-mode
162 python-mode scheme-mode sgml-mode
163 sh-mode shell-script-mode simula-mode
164 tcl-mode tex-mode texinfo-mode
165 vrml-mode xml-mode)
167 "Major Modes in which we turn on whitespace checking.
169 These are mostly programming and documentation modes. But you may add other
170 modes that you want whitespaces checked in by adding something like the
171 following to your `.emacs':
173 \(setq whitespace-modes (cons 'my-mode (cons 'my-other-mode
174 whitespace-modes))\)
176 Or, alternately, you can use the Emacs `customize' command to set this."
177 :group 'whitespace)
179 (defcustom whitespace-rescan-timer-time 600
180 "Period in seconds to rescan modified buffers for whitespace creep.
182 This is the period after which the timer will fire causing
183 `whitespace-rescan-files-in-buffers' to check for whitespace creep in
184 modified buffers.
186 To disable timer scans, set this to zero."
187 :type 'integer
188 :group 'whitespace)
190 (defcustom whitespace-display-in-modeline t
191 "Display whitespace errors on the modeline."
192 :type 'boolean
193 :group 'whitespace)
195 (if (not (assoc 'whitespace-mode minor-mode-alist))
196 (setq minor-mode-alist (cons '(whitespace-mode whitespace-mode-line)
197 minor-mode-alist)))
199 (defun whitespace-check-whitespace-mode (&optional arg)
200 "Test and set the whitespace-mode in qualifying buffers."
201 (if (null whitespace-mode)
202 (setq whitespace-mode
203 (if (or arg (member major-mode whitespace-modes))
205 nil))))
207 ;;;###autoload
208 (defun whitespace-buffer (&optional quiet)
209 "Find five different types of white spaces in buffer:
211 1. Leading space \(empty lines at the top of a file\).
212 2. Trailing space \(empty lines at the end of a file\).
213 3. Indentation space \(8 or more spaces, that should be replaced with TABS\).
214 4. Spaces followed by a TAB. \(Almost always, we never want that\).
215 5. Spaces or TABS at the end of a line.
217 Check for whitespace only if this buffer really contains a non-empty file
218 and:
219 1. the major mode is one of the whitespace-modes, or
220 2. `whitespace-buffer' was explicitly called with a prefix argument."
221 (interactive)
222 (let ((whitespace-error nil))
223 (whitespace-check-whitespace-mode current-prefix-arg)
224 (if (and buffer-file-name (> (buffer-size) 0) whitespace-mode)
225 (progn
226 (whitespace-check-buffer-list (buffer-name) buffer-file-name)
227 (whitespace-tickle-timer)
228 (if whitespace-auto-cleanup
229 (if buffer-read-only
230 (if (not quiet)
231 (message "Can't cleanup: %s is read-only" (buffer-name)))
232 (whitespace-cleanup))
233 (let ((whitespace-leading (if whitespace-check-leading-whitespace
234 (whitespace-buffer-leading)
235 nil))
236 (whitespace-trailing (if whitespace-check-trailing-whitespace
237 (whitespace-buffer-trailing)
238 nil))
239 (whitespace-indent (if whitespace-check-indent-whitespace
240 (whitespace-buffer-search
241 whitespace-indent-regexp)
242 nil))
243 (whitespace-spacetab (if whitespace-check-spacetab-whitespace
244 (whitespace-buffer-search
245 whitespace-spacetab-regexp)
246 nil))
247 (whitespace-ateol (if whitespace-check-ateol-whitespace
248 (whitespace-buffer-search
249 whitespace-ateol-regexp)
250 nil))
251 (whitespace-errmsg nil)
252 (whitespace-filename buffer-file-name)
253 (whitespace-this-modeline ""))
255 ;; Now let's complain if we found any of the above.
256 (setq whitespace-error (or whitespace-leading whitespace-indent
257 whitespace-spacetab whitespace-ateol
258 whitespace-trailing))
260 (if whitespace-error
261 (progn
262 (setq whitespace-errmsg
263 (concat whitespace-filename " contains:\n"
264 (if whitespace-leading
265 "Leading whitespace\n")
266 (if whitespace-indent
267 (concat "Indentation whitespace"
268 whitespace-indent "\n"))
269 (if whitespace-spacetab
270 (concat "Space followed by Tab"
271 whitespace-spacetab "\n"))
272 (if whitespace-ateol
273 (concat "End-of-line whitespace"
274 whitespace-ateol "\n"))
275 (if whitespace-trailing
276 "Trailing whitespace\n")
277 "\ntype `M-x whitespace-cleanup' to "
278 "cleanup the file."))
279 (setq whitespace-this-modeline
280 (concat (if whitespace-ateol "e")
281 (if whitespace-indent "i")
282 (if whitespace-leading "l")
283 (if whitespace-spacetab "s")
284 (if whitespace-trailing "t")))))
285 (whitespace-update-modeline whitespace-this-modeline)
286 (save-excursion
287 (get-buffer-create whitespace-errbuf)
288 (kill-buffer whitespace-errbuf)
289 (get-buffer-create whitespace-errbuf)
290 (set-buffer whitespace-errbuf)
291 (if whitespace-errmsg
292 (progn
293 (insert whitespace-errmsg)
294 (if (not (or quiet whitespace-silent))
295 (display-buffer whitespace-errbuf t))
296 (if (not quiet)
297 (message "Whitespaces: [%s%s] in %s"
298 whitespace-this-modeline
299 (let ((whitespace-unchecked
300 (whitespace-unchecked-whitespaces)))
301 (if whitespace-unchecked
302 (concat "!" whitespace-unchecked)
303 ""))
304 whitespace-filename)))
305 (if (not quiet)
306 (message "%s clean" whitespace-filename))))))))
307 (if whitespace-error
309 nil)))
311 ;;;###autoload
312 (defun whitespace-region (s e)
313 "Check a region specified by point and mark for whitespace errors."
314 (interactive "r")
315 (save-excursion
316 (save-restriction
317 (narrow-to-region s e)
318 (whitespace-buffer))))
320 ;;;###autoload
321 (defun whitespace-cleanup ()
322 "Cleanup the five different kinds of whitespace problems.
324 Use \\[describe-function] whitespace-describe to read a summary of the
325 whitespace problems."
326 (interactive)
327 ;; If this buffer really contains a file, then run, else quit.
328 (whitespace-check-whitespace-mode current-prefix-arg)
329 (if (and buffer-file-name whitespace-mode)
330 (let ((whitespace-any nil)
331 (whitespace-tabwith 8)
332 (whitespace-tabwith-saved tab-width))
334 ;; since all printable TABS should be 8, irrespective of how
335 ;; they are displayed.
336 (setq tab-width whitespace-tabwith)
338 (if (and whitespace-check-leading-whitespace
339 (whitespace-buffer-leading))
340 (progn
341 (whitespace-buffer-leading-cleanup)
342 (setq whitespace-any t)))
344 (if (and whitespace-check-trailing-whitespace
345 (whitespace-buffer-trailing))
346 (progn
347 (whitespace-buffer-trailing-cleanup)
348 (setq whitespace-any t)))
350 (if (and whitespace-check-indent-whitespace
351 (whitespace-buffer-search whitespace-indent-regexp))
352 (progn
353 (whitespace-indent-cleanup)
354 (setq whitespace-any t)))
356 (if (and whitespace-check-spacetab-whitespace
357 (whitespace-buffer-search whitespace-spacetab-regexp))
358 (progn
359 (whitespace-buffer-cleanup whitespace-spacetab-regexp "\t")
360 (setq whitespace-any t)))
362 (if (and whitespace-check-ateol-whitespace
363 (whitespace-buffer-search whitespace-ateol-regexp))
364 (progn
365 (whitespace-buffer-cleanup whitespace-ateol-regexp "")
366 (setq whitespace-any t)))
368 ;; Call this recursively till everything is taken care of
369 (if whitespace-any
370 (whitespace-cleanup)
371 (progn
372 (message "%s clean" buffer-file-name)
373 (whitespace-update-modeline)))
374 (setq tab-width whitespace-tabwith-saved))))
376 ;;;###autoload
377 (defun whitespace-cleanup-region (s e)
378 "Whitespace cleanup on a region specified by point and mark."
379 (interactive "r")
380 (save-excursion
381 (save-restriction
382 (narrow-to-region s e)
383 (whitespace-cleanup))
384 (whitespace-buffer t)))
386 (defun whitespace-buffer-leading ()
387 "Check to see if there are any empty lines at the top of the file."
388 (save-excursion
389 (let ((pmin nil)
390 (pmax nil))
391 (goto-char (point-min))
392 (beginning-of-line)
393 (setq pmin (point))
394 (end-of-line)
395 (setq pmax (point))
396 (if (equal pmin pmax)
398 nil))))
400 (defun whitespace-buffer-leading-cleanup ()
401 "Remove any empty lines at the top of the file."
402 (save-excursion
403 (let ((pmin nil)
404 (pmax nil))
405 (goto-char (point-min))
406 (beginning-of-line)
407 (setq pmin (point))
408 (end-of-line)
409 (setq pmax (point))
410 (if (equal pmin pmax)
411 (progn
412 (kill-line)
413 (whitespace-buffer-leading-cleanup))))))
415 (defun whitespace-buffer-trailing ()
416 "Check to see if are is more than one empty line at the bottom."
417 (save-excursion
418 (let ((pmin nil)
419 (pmax nil))
420 (goto-char (point-max))
421 (beginning-of-line)
422 (setq pmin (point))
423 (end-of-line)
424 (setq pmax (point))
425 (if (equal pmin pmax)
426 (progn
427 (goto-char (- (point) 1))
428 (beginning-of-line)
429 (setq pmin (point))
430 (end-of-line)
431 (setq pmax (point))
432 (if (equal pmin pmax)
434 nil))
435 nil))))
437 (defun whitespace-buffer-trailing-cleanup ()
438 "Delete all the empty lines at the bottom."
439 (save-excursion
440 (let ((pmin nil)
441 (pmax nil))
442 (goto-char (point-max))
443 (beginning-of-line)
444 (setq pmin (point))
445 (end-of-line)
446 (setq pmax (point))
447 (if (equal pmin pmax)
448 (progn
449 (goto-char (1- pmin))
450 (beginning-of-line)
451 (setq pmin (point))
452 (end-of-line)
453 (setq pmax (point))
454 (if (equal pmin pmax)
455 (progn
456 (goto-char (1- (point-max)))
457 (beginning-of-line)
458 (kill-line)
459 (whitespace-buffer-trailing-cleanup))))))))
461 (defun whitespace-buffer-search (regexp)
462 "Search for any given whitespace REGEXP."
463 (let ((whitespace-retval ""))
464 (save-excursion
465 (goto-char (point-min))
466 (while (re-search-forward regexp nil t)
467 (setq whitespace-retval (format "%s %s " whitespace-retval
468 (match-beginning 0))))
469 (if (equal "" whitespace-retval)
471 whitespace-retval))))
473 (defun whitespace-buffer-cleanup (regexp newregexp)
474 "Search for any given whitespace REGEXP and replace it with the NEWREGEXP."
475 (save-excursion
476 (goto-char (point-min))
477 (while (re-search-forward regexp nil t)
478 (replace-match newregexp))))
480 (defun whitespace-indent-cleanup ()
481 "Search for 8/more spaces at the start of a line and replace it with tabs."
482 (save-excursion
483 (goto-char (point-min))
484 (while (re-search-forward whitespace-indent-regexp nil t)
485 (let ((column (current-column))
486 (indent-tabs-mode t))
487 (delete-region (match-beginning 0) (point))
488 (indent-to column)))))
490 (defun whitespace-unchecked-whitespaces ()
491 "Return the list of whitespaces whose testing has been suppressed."
492 (let ((whitespace-this-modeline
493 (concat (if (not whitespace-check-ateol-whitespace) "e")
494 (if (not whitespace-check-indent-whitespace) "i")
495 (if (not whitespace-check-leading-whitespace) "l")
496 (if (not whitespace-check-spacetab-whitespace) "s")
497 (if (not whitespace-check-trailing-whitespace) "t"))))
498 (if (not (equal whitespace-this-modeline ""))
499 whitespace-this-modeline
500 nil)))
502 (defun whitespace-update-modeline (&optional whitespace-err)
503 "Update modeline with whitespace errors and whitespaces whose testing has
504 been turned off."
505 (if whitespace-display-in-modeline
506 (progn
507 (setq whitespace-mode-line nil)
508 ;; Whitespace errors
509 (if (and whitespace-err (not (equal whitespace-err "")))
510 (setq whitespace-mode-line whitespace-err))
511 ;; Whitespace suppressed errors
512 (let ((whitespace-unchecked (whitespace-unchecked-whitespaces)))
513 (if whitespace-unchecked
514 (setq whitespace-mode-line
515 (concat whitespace-mode-line "!" whitespace-unchecked))))
516 ;; Add the whitespace modeline prefix
517 (setq whitespace-mode-line (if whitespace-mode-line
518 (concat " W:" whitespace-mode-line)
519 nil))
520 (whitespace-force-mode-line-update))))
522 ;; Force mode line updation for different Emacs versions
523 (defun whitespace-force-mode-line-update ()
524 "Force the mode line update for different flavors of Emacs."
525 (if whitespace-running-emacs
526 (force-mode-line-update) ; Emacs
527 (redraw-modeline))) ; XEmacs
529 (defun whitespace-check-buffer-list (buf-name buf-file)
530 "Add a buffer and its file to the whitespace monitor list.
532 The buffer named BUF-NAME and its associated file BUF-FILE are now monitored
533 periodically for whitespace."
534 (if (and whitespace-mode (not (member (list buf-file buf-name)
535 whitespace-all-buffer-files)))
536 (add-to-list 'whitespace-all-buffer-files (list buf-file buf-name))))
538 (defun whitespace-tickle-timer ()
539 "Tickle timer to periodically to scan qualifying files for whitespace creep.
541 If timer is not set, then set it to scan the files in
542 `whitespace-all-buffer-files' periodically (defined by
543 `whitespace-rescan-timer-time') for whitespace creep."
544 (if (and whitespace-rescan-timer-time (not whitespace-rescan-timer))
545 (setq whitespace-rescan-timer
546 (if whitespace-running-emacs
547 (run-at-time nil whitespace-rescan-timer-time
548 'whitespace-rescan-files-in-buffers)
549 (add-timeout whitespace-rescan-timer-time
550 'whitespace-rescan-files-in-buffers nil
551 whitespace-rescan-timer-time)))))
553 (defun whitespace-rescan-files-in-buffers (&optional arg)
554 "Check monitored files for whitespace creep since last scan."
555 (let ((whitespace-all-my-files whitespace-all-buffer-files)
556 buffile bufname thiselt buf)
557 (if (not whitespace-all-my-files)
558 (progn
559 (if whitespace-running-emacs
560 (cancel-timer whitespace-rescan-timer)
561 (disable-timeout whitespace-rescan-timer))
562 (setq whitespace-rescan-timer nil))
563 (while whitespace-all-my-files
564 (setq thiselt (car whitespace-all-my-files))
565 (setq whitespace-all-my-files (cdr whitespace-all-my-files))
566 (setq buffile (car thiselt))
567 (setq bufname (cadr thiselt))
568 (setq buf (get-buffer bufname))
569 (if (buffer-live-p buf)
570 (save-excursion
571 ;;(message "buffer %s live" bufname)
572 (set-buffer bufname)
573 (if whitespace-mode
574 (progn
575 ;;(message "checking for whitespace in %s" bufname)
576 (if whitespace-auto-cleanup
577 (progn
578 ;;(message "cleaning up whitespace in %s" bufname)
579 (whitespace-cleanup))
580 (progn
581 ;;(message "whitespace-buffer %s." (buffer-name))
582 (whitespace-buffer t))))
583 ;;(message "Removing %s from refresh list" bufname)
584 (whitespace-refresh-rescan-list buffile bufname)))
585 ;;(message "Removing %s from refresh list" bufname)
586 (whitespace-refresh-rescan-list buffile bufname))))))
588 (defun whitespace-refresh-rescan-list (buffile bufname)
589 "Refresh the list of files to be rescaned for whitespace creep."
590 (if whitespace-all-buffer-files
591 (progn
592 (setq whitespace-all-buffer-files
593 (delete (list buffile bufname) whitespace-all-buffer-files)))
594 (progn
595 (if (and whitespace-running-emacs (timerp whitespace-rescan-timer))
596 (cancel-timer whitespace-rescan-timer))
597 (if (and (not whitespace-running-emacs) whitespace-rescan-timer)
598 (disable-timeout whitespace-rescan-timer))
599 (if whitespace-rescan-timer
600 (setq whitespace-rescan-timer nil)))))
602 ;;;###autoload
603 (defun whitespace-describe ()
604 "A summary of whitespaces and what this library can do about them.
606 The whitespace library is intended to find and help fix five different types
607 of whitespace problems that commonly exist in source code.
609 1. Leading space (empty lines at the top of a file).
610 2. Trailing space (empty lines at the end of a file).
611 3. Indentation space (8 or more spaces at beginning of line, that should be
612 replaced with TABS).
613 4. Spaces followed by a TAB. (Almost always, we never want that).
614 5. Spaces or TABS at the end of a line.
616 Whitespace errors are reported in a buffer, and on the modeline.
618 Modeline will show a W:<x>!<y> to denote a particular type of whitespace,
619 where `x' and `y' can be one (or more) of:
621 e - End-of-Line whitespace.
622 i - Indentation whitespace.
623 l - Leading whitespace.
624 s - Space followed by Tab.
625 t - Trailing whitespace.
627 If any of the whitespace checks is turned off, the modeline will display a
628 !<y>.
630 (since (3) is the most controversial one, here is the rationale: Most
631 terminal drivers and printer drivers have TAB configured or even
632 hardcoded to be 8 spaces. (Some of them allow configuration, but almost
633 always they default to 8.)
635 Changing tab-width to other than 8 and editing will cause your code to
636 look different from within Emacs, and say, if you cat it or more it, or
637 even print it.
639 Almost all the popular programming modes let you define an offset (like
640 c-basic-offset or perl-indent-level) to configure the offset, so you
641 should never have to set your tab-width to be other than 8 in all these
642 modes. In fact, with an indent level of say, 4, 2 TABS will cause Emacs
643 to replace your 8 spaces with one \t (try it). If vi users in your
644 office complain, tell them to use vim, which distinguishes between
645 tabstop and shiftwidth (vi equivalent of our offsets), and also ask them
646 to set smarttab.)
648 All the above have caused (and will cause) unwanted codeline integration and
649 merge problems.
651 whitespace.el will complain if it detects whitespaces on opening a file, and
652 warn you on closing a file also. (if in case you had inserted any
653 whitespaces during the process of your editing.)"
654 (interactive)
655 (message "Use C-h f whitespace-describe to read about whitespace.el v%s."
656 whitespace-version))
658 (provide 'whitespace)
660 ;;; whitespace.el ends here