Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a simple TCL code indent program?

1,552 views
Skip to first unread message

Frank

unread,
Apr 18, 2015, 4:01:43 PM4/18/15
to
Hi,

I am looking for a very simple TCL code beautifier.

What I am looking for is to indent the blocks of code by certain amount of spaces (not tabs). See example at the bottom.

Ideally I would like to be able to run it within Komodo and Eclipse.

I have seen Frink as a TCL beautifier but on the TCL Wiki it said that it could mess-up the code once in a while. I tried it a while back and messed up my code. :( Therefore I am looking for a very simple functionality nothing fancy.

proc abc {} {
# main body
if {} {
# if body
for {} {
#for body
}
}
}

yyamasak

unread,
Apr 19, 2015, 2:30:38 AM4/19/15
to
I use reformat.tcl.

The original code was taken from Tcler's wiki.
http://wiki.tcl.tk/15731

I don't remember if I did something additional to this code.
But the following gist is what I use for myself now.

http://goo.gl/jV7QJV

Olivier

unread,
Apr 19, 2015, 6:41:39 AM4/19/15
to
>
> I am looking for a very simple TCL code beautifier.
>
> What I am looking for is to indent the blocks of code by certain amount of spaces (not tabs). See example at the bottom.
>
> Ideally I would like to be able to run it within Komodo and Eclipse.

A solution but without Komodo or Eclipse : http://www.tcl-home.de/ased/asedhome.htm ... Use the "exe", it is the most simple and has all inclused. When doubleclicking, it will ask you to install "frink" "diff" and "kill" ( simply copies of exe ). You may choose "no" as you don't need them to indent file.
Now open your tcl file , then "edit/autoindent file"... It is done autoindentically :D ! You can change the length of the tab ( in "options" check also that you have "change tabs into spaces".)

It was built for 8.4, so I don't know how it reacts to new command or things like {*} ?

ASED was a very nice tcl/tk editor, and in pure tcl !

Olivier.

Olivier

unread,
Apr 19, 2015, 6:48:04 AM4/19/15
to
Ooops .. the tcl code is in proc editorWindows::autoIndent in editor.tcl from the zip distribution ... :-/

Frank

unread,
Apr 19, 2015, 3:11:01 PM4/19/15
to
Thanks. Now to see if it is possible to insert this in Eclipse and Komodo.

Frank

unread,
Apr 19, 2015, 3:17:22 PM4/19/15
to
Thank you Oliver but I am looking one for Eclipse and Komodo.

Vi and Emacs provides this capability but I am trying to stay within the IDEs.

I really like Emacs support for the TCL language but there are a few things in Eclipse that I really like.

pal...@yahoo.com

unread,
Apr 19, 2015, 10:27:38 PM4/19/15
to
Have you tried the DLTK extension for scripting languages (inc. Tcl) with Eclipse ?

Frank

unread,
Apr 20, 2015, 8:06:17 AM4/20/15
to
Hi Oliver,

First run through it reported unbalanced curly braces '}'. Also it dumps some debugging numbers to stdout. Therefore it has issues. Maybe you tweaked something on your version or don't have my code situation.

I found that I can easily add an external program to Komodo and use it as formatter. It has to read the code to format from stdin. I am not sure on Eclipse. I have not looked at Eclipse yet.

Alexandre Ferrieux

unread,
Apr 20, 2015, 9:52:30 AM4/20/15
to
On Monday, April 20, 2015 at 2:06:17 PM UTC+2, Frank wrote:
>
> I found that I can easily add an external program to Komodo and use it as formatter. It has to read the code to format from stdin. I am not sure on Eclipse. I have not looked at Eclipse yet.

Then I guess one could read stdin line by line and harness [info complete] to know whether the "level" has changed. One simple idea is to add "}"s until [info complete] returns 1. The number of braces gives the level.

-Alex

Olivier

unread,
Apr 20, 2015, 5:12:33 PM4/20/15
to

>
> First run through it reported unbalanced curly braces '}'. Also it dumps some debugging numbers to stdout. Therefore it has issues. Maybe you tweaked something on your version or don't have my code situation.

The version I used, is the version you downloaded. I didn't use it since a long time as it became an abandonware, and now use Notepad++, and I am my own auto-indenter ... "TAB" "TAB" "Shit TAB" .. :D ! Joke apart, Notepad++ has an auto-indent function for C++ and it makes a great part of the job. ASED had problem with file with extension that were not "*.tcl" (and the text in Tcl language), but with files with "*.tcl" extension, I didn't seen "unbalanced braces" problem, when the file has good syntax, I mean with all balanced braces.

Olivier.

Olivier

unread,
Apr 20, 2015, 5:15:08 PM4/20/15
to
Re-oops... need to go to sleep .. "Shift TAB" of course :-/ ..

Frank

unread,
Apr 26, 2015, 7:09:37 PM4/26/15
to
Hi Alex,

yes. I thought about using info complete but did not want to reinvent the wheel. I wanted to check first before I start writing something. :)

I could also look into reformat.tcl and see if I can figure out the problem. It complained when there were curlys inside quotes.

Christian Gollwitzer

unread,
Apr 27, 2015, 2:37:24 AM4/27/15
to
Am 27.04.15 um 01:09 schrieb Frank:
I'm using the code below, which is based on the wiki, and I remember
fixing some problems a couple of years ago. Does it work for your code?

http://pastebin.com/FRJKED96

Christian

Bogdan Plynth

unread,
Apr 27, 2015, 5:04:24 AM4/27/15
to
On 2015-04-18, Frank <kra...@gmail.com> wrote:
> Hi,
>
> I am looking for a very simple TCL code beautifier.
>
> What I am looking for is to indent the blocks of code by certain amount of spaces (not tabs). See example at the bottom.
>
> Ideally I would like to be able to run it within Komodo and Eclipse.

I use Emacs for everything and it does fine so far on Tcl. I'm a beginner in
Tcl so I didn't use all the constructs possible in it. I heard about Komodo
but when I tried it a few years ago I didn't like it. I didn't know Eclipse
had any support for Tcl. What plugin is it? I can understand using Komodo
for Tcl because Komodo specifically supports Tcl doesn't it? But Eclipse? It
sounds like an 800 pound gorilla. Emacs is much better for quick editing
than Eclipse. I never thought I would say Emacs and quick at the same time
but today it happened.

Below is what I get from Emacs in Tcl mode on your example

Bogdan
0 new messages