I think the jQuery load order message on that other stack overflow question is a bit of a red herring Paul. Or perhaps I'm misunderstanding your question. But I'm currently using tinymce Version 4.0.12 with the jQuery plugin and am loading my own custom plugins from a custom directory. You should load your tinymce initialiser within an anonymous function call but I wouldn't load your plugin from within one.
This is a bit simplified but the load order of my js files would be something like this:
<script src="/javascripts/libs/jquery-1.10.2.js" type="text/javascript"></script>
<script src="/javascripts/tinymce_dev/js/tinymce/tinymce.js" type="text/javascript"></script>
<script src="/javascripts/tinymce_dev/js/tinymce/jquery.tinymce.min.js" type="text/javascript"></script>
<script src="/javascripts/custom/plugins/pps_save/plugin.js" type="text/javascript"></script>
<script src="/javascripts/custom/plugins/pps_font_format/plugin.js" type="text/javascript"></script>
These paths include 2 custom plugins that I've written called pps_save and pps_font_format which I'm using to override the defaults with a few custom things I want to do. Anyways, the plugin code for the pps_save plugin looks something like this:
tinymce.PluginManager.add('pps_save', function(editor) {
...
...myCustomCode
...
editor.addCommand('mce_pps_Save', saveMessage);
editor.addCommand('mce_pps_Revert', revert);
editor.addButton('pps_save', {
icon: false,
text: 'Save',
cmd: 'mce_pps_Save',
disabled: false
});
editor.addButton('pps_revert', {
text: 'Revert',
icon: false,
cmd: 'mce_pps_Revert',
disabled: false
});
editor.addShortcut('ctrl+s', '', 'mceSave');
});
And then the tinymce initialiser code looks something like this:
$(function() {
$('#msg_textarea').tinymce({
...
...
plugins: [
"advlist lists image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking table contextmenu directionality",
"paste textcolor",
"pps_save pps_font_format"
],
toolbar1: "pps_save pps_revert | alignleft aligncenter alignright alignjustify | pps_font_select | pps_font_size_select",
toolbar2: ...
...
});
});
Apologies for the naming convention I've used as well but note you can create multiple different buttons within a single plugin (ie pps_save, pps_revert), so within my tinymce initialiser above I'm loading the pps_save plugin in the plugins : [] array but then using the pps_save "Button" I created in my plugin in the toolbar along with my pps_revert button.
Anyways, hope that helps, all the best.