emacs-scad-mode icon indicating copy to clipboard operation
emacs-scad-mode copied to clipboard

Recognize #

Open lucasoshiro opened this issue 9 months ago • 2 comments

Hi!

This mode doesn't recognize # in .scad files. # is used for debugging scad files, highlighting the object defined after it.

Inserting # while using this mode breaks the indentation, sometimes leading to more severe misparsing that are only solved by restarting scad-mode

So, this issue requests as a feature dealing correctly with #

Thanks!

lucasoshiro avatar Mar 05 '25 00:03 lucasoshiro

Can you give an example please? Patches welcome.

minad avatar Mar 08 '25 15:03 minad

Can you give an example please?

Sure, here's a simple one:

union() {
    union() {
        #cube();
        sphere();
    }
}

If you use scad-mode + electric-indent-mode, for example, after pressing TAB the #cube(); statement goes to the left extreme. The same doesn't happen if we use %.

About it leading to more severe problems, I can't find a simple reproducible example as it occurs only after editing a scad with # for a while...

Patches welcome.

I tried to find a solution, but I never wrote major modes on elisp... I but I think this happens because of the dependency on cc-mode-related stuff, specially because in C/C++ the # is primarily used for defining preprocessor directives, which normally are in the top-level indent

lucasoshiro avatar Mar 08 '25 21:03 lucasoshiro