From: fred.holmes@mix.cpcug.org (FRED HOLMES)
For Kurt Wessels:
Here's a macro that G de B provided me a long time ago to strip
trailing whitespace throughout a file. You have to set
RemoveTrailingWhite to on if it isn't on, and then place the
cursor on each successive line.
/* WHITESP.S
The purpose of this macro is to eliminate white space at
the end of each line of a document. This is accomplished
automatically only for a line that the cursor rests on.
Therefore, one has to Down() for every line of the file,
with RemoveTrailingWhite = on. */
integer n = 0
Proc Main()
integer rtw=Set(RemoveTrailingWhite, ON)
BegFile()
BegLine()
For n = 1 to Numlines()
Down()
EndFor
BegFile()
Set(RemoveTrailingWhite, rtw)
FileChanged(TRUE)
Message("WHITESP.S is done.")
End // Proc Main()
/* Process provided by George de Bruin, after searching the
BBS and not finding it, and then searching the
``newsgroup''.
As specified in the above description, the whitespace is _only_
removed from lines that the cursor is actually placed on. An
easy way to get the editor to remove all of the trailing
whitespace from a file would be to use a macro like this:
proc ForceRemoveWhite()
PushPosition()
BegFile()
repeat until not Down()
PopPosition()
end
*/
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|