The existing emenu code has this odd exception where if you invoke it on a menu with bound in Vim, and has a macaction, it will call the macaction instead. However, it's not properly handling the situation when the menu is not bound for the mode and would crash when deferencing a null string ptr. Move it to the proper spot and fix up a previous upstream merge mistake (in Vim upstream, when you call :emenu on a menu item it just does nothing now, instead of complaining about it) so that it all works correctly.
The existing emenu code has this odd exception where if you invoke it on a menu with bound in Vim, and has a macaction, it will call the macaction instead. However, it's not properly handling the situation when the menu is not bound for the mode and would crash when deferencing a null string ptr. Move it to the proper spot and fix up a previous upstream merge mistake (in Vim upstream, when you call :emenu on a menu item it just does nothing now, instead of complaining about it) so that it all works correctly.