SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started by: timur on July 17, 2011, 03:40:35 AM
-
I have a project of C files, and the Tools->Beautify option is greyed out. When I try the "gui-beautify" command, the status line says, "Command is disabled for this object". I don't even know what this means.
I'm using Slickedit 2011 for Linux x86-64.
-
The only thing I can think of is that SlickEdit does not recognize the extension as C/C++. If that is the case, then go to Tools>Options>File Extension Manager, New. Add the offending extension and associate it with C/C++.
--rodney++
-
I've associated them with ANSI-C, because I don't want it to recognize C++ keywords. I changed the association back to C/C++, but that didn't fix it.
I even deleting my ~/.slickedit folder to reset all options, and it's still greyed out.
-
I would have expected deleting your config-directory to have solved it for sure. What exactly is the extension on these files?
--rodney++
-
Just ".c" and ".h", like any normal C files.
-
Okay. When you have one of these files open, bring up the Document menu. For the "Select Mode" item you should see:
Select Mode (C/C++)...
Please confirm.
--rodney++
-
Ah, I changed the document mode from ANSI-C to C/C++ and now it works.
Why can't I beautify ANSI-C code?
-
The C++ beautifier cannot deal with 'class' as a keyword. I do not believe it likes old-style function signatures either. Those are just a couple good reasons. For now you will have to switch modes. I leave you with a code sample I plucked from the internet that would give our beautifier fits:
static void class_release(struct kobject *kobj)
{
struct class_private *cp = to_class(kobj);
struct class *class = cp->class;
pr_debug("class '%s': release.\n", class->name);
if (class->class_release)
class->class_release(class);
else
pr_debug("class '%s' does not have a release() function, "
"be careful\n", class->name);
kfree(cp);
}
--rodney++