You can write a simple lisp routine to clear out comments. You will need to decide whether to
you want to deal with inline/multiline notes as well ie
;| This is a comment |;
-David
Yeah, David - I was thinking about writing some conditional that switches few booleans if comment is active.
And would process the list of strings from the .lsp file. But just left it as starting conception (not finished) :
(cond ( (not row) ) ( (setq row (car L)) (setq L (cdr L)) ) )
(cond
( (not row) row)
(cmt (setq row nil) ) ; comment mode is on
( (wcmatch row "*;|*") (setq cmt T) (setq row nil) ) ; comment mode on
( (wcmatch row "*|;*") (setq cmt nil) (setq row (TrimStingUpTo row "|;")) ) ; comment mode off
( (wcmatch row "*;*") ; theres a code'n'comment
(setq row (TrimStingUpTo row ";"))
)
( (wcmatch row "*;") ; code and a single ';'
(setq row (TrimStingUpTo row ";"))
)
( (wcmatch row ";*") ; comment
(setq row nil)
)
(T row) ; no comment, only code
); cond
Unfortunately I'm tight on free time again, but would finish it if it was very important (although initially I didn't think the task would translate into coding).
Don't have time for more than quick & dirty ...
Seems to work - Thanks for sharing your skills, Michael!
Question, why do you want to remove comments?
Simply said:
over commentingSay I wanted to learn someone's code by reading whats happening in the plain code, but there are too many comments that I loose my mind in a redundant descriptions, (thru the mid-evaluation).
Other reason would be, if the code is commented in Spanish/Russian/German/Chineese - a lisper might don't know the language, but still would be able to understand whats happening in there (and the comments still get in the way).
Few times I had such problem, so that brought my question that there might be a global solution for this.
And I'm not talking about removing any copyrighted footers or headers(that'd be silly), but a stuff like:
(+
; Hey hey
; This is ..
; ...
; ...
; bla-bla
; bla-bla
2
)
; ...
3
)
It's a Trump directive.
That would be
"How do I remove twitter comments".
EDIT:
MP, I've forgot to mention that I did a small addition to your code:
inside
nom's def.. :
(and (or (and lisp (findfile lisp)) (setq lisp (getfiled "Specify LISP file" (strcat (getenv "userprofile") "\\Desktop\\") "lsp" 16))) (setq handle (open lisp "r")))
so then:
(_CleanLisp "sample.lsp") or (_CleanLisp nil)