Loading ...
Sorry, an error occurred while loading the content.

Re: [jasspa] Tcl indent problem?

Expand Messages
  • Steven Phillips
    Jeremy, Try adding the following line to your mytcl.emf: indent .hilight.tcl n [[^][{ ]*{ t This rules identifies the [ ..... { and treats it like a
    Message 1 of 3 , Sep 14, 2010
    • 0 Attachment
      Jeremy,

      Try adding the following line to your mytcl.emf:

          indent .hilight.tcl n "\\[[^][{\"]*{"  t

      This rules identifies the '[ ..... {' and treats it like a single '{'. This could have side effects, i.e. matching when it shouldn't, so you may need to tweak it. If this works correctly then we'll add it to the main hktcl.emf so please let us know how you get on.

      Steve

      cp200205 wrote:
       

      I am having problems with the default Tcl mode indenting this code snippet correctly (periods prefixed for spacing of how MicroEmacs indents it:

      if { 1 } {
      ....puts hi
      } elseif { 2 } {
      ....set band [::db onecolumn {
      ............SELECT id FROM band WHERE freq=$freq
      ........}]
      ....}
      ....puts bad

      It has to do with the [ and { being on the same line. I've tried playing with the indentation some in the mode config but have failed to come up with a working solution. If I rewrite the above code to have [ and { on different lines, then the indentation works properly. The problem with doing this is the above syntax is very common, placing the [ and { on different lines is not and requires the use of an escape character \

      Thanks for any input,

      Jeremy Cowgar

    • Jeremy Cowgar
      That makes things better but it just lead me to discover another problem with the tcl indenting. When a continuation character is used, the next if statement
      Message 2 of 3 , Sep 14, 2010
      • 0 Attachment
        That makes things better but it just lead me to discover another problem with the tcl indenting. When a continuation character is used, the next if statement does not indent properly...

        set row [mk::select logdb.log \
        ................-exact startedAt 10]
        if { $row eq {} } {
        incr impCnt

        i.e. incr impCnt will not indent. If I change it to:

        set row [mk::select logdb.log -exact startedAt 10]
        if { $row eq {} } {
        ....incr impCnt

        then it indents fine. Sorry to keep reporting the problems :-(

        Jeremy Cowgar

        On 9/14/2010 3:46 AM, Steven Phillips wrote:
         

        Jeremy,

        Try adding the following line to your mytcl.emf:

            indent .hilight.tcl n "\\[[^][{\"]*{"  t

        This rules identifies the '[ ..... {' and treats it like a single '{'. This could have side effects, i.e. matching when it shouldn't, so you may need to tweak it. If this works correctly then we'll add it to the main hktcl.emf so please let us know how you get on.

        Steve

        cp200205 wrote:

         

        I am having problems with the default Tcl mode indenting this code snippet correctly (periods prefixed for spacing of how MicroEmacs indents it:

        if { 1 } {
        ....puts hi
        } elseif { 2 } {
        ....set band [::db onecolumn {
        ............SELECT id FROM band WHERE freq=$freq
        ........}]
        ....}
        ....puts bad

        It has to do with the [ and { being on the same line. I've tried playing with the indentation some in the mode config but have failed to come up with a working solution. If I rewrite the above code to have [ and { on different lines, then the indentation works properly. The problem with doing this is the above syntax is very common, placing the [ and { on different lines is not and requires the use of an escape character \

        Thanks for any input,

        Jeremy Cowgar


      Your message has been successfully submitted and would be delivered to recipients shortly.