After some more testing tomorrow, and merging it to HEAD, I intend to commit this patch (categories.patch.txt) to the 1.9 stable branch.
MDL-17479, MDL-16426, MDL-16063, MDL-16013, MDL-15658, MDL-15556, MDL-15161, MDL-14925, MDL-13742, MDL-11557.
I chose this bug to attach the patch to because it had the most watchers!
Apologies for the fact it is one big patch, rather than a series of smaller patches. However, categoryedit.php, category.php and index.php where in pretty bad shape and needed significant cleaning up. categoryedit.php, in particular, was almost completely rewritten to bring it in line with modern Moodle coding practices. Doing that fixed a lot of bugs at once.
There are still about a dozen category related bugs on my list, but I am able to separate them out, and hope to be committing fixes for them in the next few days.
If anyone has some spare cycles to review or test this before tomorrow, that would be great, but I am not expecting anything. Thanks.