Page 1 of 1

Store, turn off and restore SmartIndent from macro

Posted: Thu Nov 03, 2005 10:49 am
by martinlooker
Is there a way to store, turn off and restore the SmartIndent mode from a macro.

I'm attempting to insert a comment in the style, note the leading space prior to the */:

Code: Select all

/*
 *
 */
When I have smart indent turned on the line following the */ get indented one space, so I'd like to control the SmartIndenting from the macro to avoid this or is there an alternative ?

I'm using MoveLineHome before each insert to avoid getting an extra space on the */ line frmo the * line's indent but I can't control that for the line following the whole comment block.

Posted: Thu Nov 03, 2005 11:18 am
by jussij
Just use the write function to output the text:

Code: Select all

function key_macro()
    screen_update_disable()
    FileNew()
    write("     Something to indent against...\n")
    -- output with smart indent
    write("/*\n**\n*/\n")
    -- output with no smart indent
    write("\n/*\n**\n*/\n", 0)
    screen_update_enable()
    screen_update()
end

key_macro() -- run the macro
For more details put the cursor on the write function and use the Help, Quick Help menu.

Cheers Jussi

Posted: Thu Nov 03, 2005 11:26 am
by martinlooker
Ahh, thanks again I was using print copied from another macro.

That no smart indent flag isn't in the help file for the write function by the way.