clean(3)
[Home]
[Commands]
[Variables]
[Macro-Dev]
[Glossary]
NAME
SYNOPSIS
DESCRIPTION
clean removes redundant white spaces from the current buffer, there are three types this command remove:
1)
Any space or tab character at the end of the line. All are removed until the last character is not a space or a tab, or the line is empty. Note that an empty line is not removed unless at the end of the buffer.
2)
Space characters are removed when the next character is a tab, making the space redundant, e.g. the strings " Hello World" and " Hello World" will look identical because the tab character (' ') indents the text to the 8th column with or without the space so the space can be removed.
3)
Superfluous empty lines at the end of the buffer are removed, leaving only one empty line.
4)
If argument n is given (value is not used) multiple blank lines are reduced to a single blank line.
DIAGNOSTICS
NOTES
clean is a macro defined in format.emf.
Most of this command's operation is performed by simple regex search and replace strings:
a)
Search for: "[\t ]+$" Replace with: "\\0"
b)
Search for: "[ ]+\t" Replace with: "\t"
c)
Search for: "\n\n\n" Replace with: "\n\n"
It is useful to define a new command called spotless in the user macro file which cleans the file and removes blank lines. The new command is defined as follows:-
; spotless; Perform a clean and remove any multi-blank lines.
define-macro spotless
-1 clean
!emacro
SEE ALSO
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12