It seems like a lot of trouble is caused by trying to maintain the Digispark Arduino IDE varient with both digispark and traditional arduino ide support. I propose giving up on that, and making the Digispark IDE only support digispark-compatibles, and redoing the libraries so they are API-compatible with the standard arduino ones.
There's no reason the digispark couldn't implement the standard arduino Keyboard and Mouse libraries, or for that matter implement USB Serial emulation as an alternative to DigiUSB. There's no technological reason why you shouldn't be able to use all of Keyboard, Mouse, and DigiUSB together - they're all HID devices and fairly easy to merge with some preprocessor ifdefs to keep code size under control by omiting the bits your project isn't opting in to. For that matter, Mangler could detect the presence of Keyboard.begin, Mouse.begin, and DigiUSB.begin, and use that to control what libraries are included and how, as well as controlling the hid descriptor at compile time (straight forward to do) I don't yet know if it would be straight forward to support USB Serial Port emulation at the same time as keyboard and mouse, but some arduino's seem to be able to do it so it might be possible for digispark as well.
Imagine if digispark just supported USB serial emulation out of the box? that'd make so many people happy, even if it's a bit of a dodgy hack (but lets be honest, just about everything here is)
What do you guys think? What do Digistump think? Should the Digispark software abandon Arduino as a target and focus in exclusively on supporting digispark-compatibles while staying as API compatible and library compatible with arduino as possible, getting rid of all this DigiKeyboard, DigiMouse gunk in favour of Keyboard, Mouse?
I'm investigating the possibility of calling usbPoll from the millis timer system - if that can be made to work, Mouse, Keyboard, DigiUSB, will be able to be made to not require special delay functions or calling refresh/update functions in your program.