I got the fruitless task to incorporate some programs my predecessor wrote. One horrible mess of unorganized code.
So far I know only about the automatic identation (C-i). So I wonder if you can suggest some tool.
some key problems I’m having:
- Assignment to the same structure is sparkled through the whole file
- This is one big file of code – I would like to split it
- Quite a lot of code produces results that are never used
Update
On the nice looking part I found that the Matlab mode of Emacs can break overlong lines quite reasonable.
Incremental refactoring is the way forward.
Unfortunately there is no magic bullet. You can rely on the Matlab linter, which will tell you when a variable is never assigned to or used, or when a function is never called, but beyond that you need to tidy the code up a piece at a time, testing it as you go.