I'm sorry, but I misspoke rather badly before when I wrote about how macros are loaded. Let's say your have a macro stored in a file called "abcd". If you go to the command line ("^k") and type "abcd" and hit Enter, several things will happen:
- ne looks for a built-in command by that name. If it doesn't find one, it proceeds to...
- looks in its table of already loaded macros for a cached macro by that name. If it doesn't find one, it then...
- looks in the current directory for a file by that name. If that doesn't work, it...
- looks in your ~/.ne directory for a file by that name. If that also fails, it...
- looks in your $NE_GLOBAL_DIR/macros directory for a file by that name.
If none of that works, you get a "
No such command" message.
Let's suppose that your "abcd" file is in your ~/my_macros directory. So you go to your command line ("^k") and type "~/my_macros/abcd" and hit Enter. This time, you get nothing! Not even an error! Here's what happened:
- ne looked at the command line, saw that the first non-blank character was not an ASCII letter, and considered it a NOP (that is, "No Operation").
To load and execute
~/my_macros/abcd the first time, you have to explicitly use the
Macro command:
^k macro ~/my_macros/abcd <Enter>
Subsequent times - at least until you run the UnloadMacros command - you can simply type "abcd" on the command line and hit Enter as in the first scenario above. This works because ne looks up named cached macros by their names only, with no regard to their path (or case!).
You could always use the Macro command with the full path to each macro and avoid any ambiguity. This would even allow you to have macros with the same names as built-in commands. Be aware though that even then, named macros are cached and looked up by their names, and their path only matters the first time they are loaded. That remains the case until you end your ne session or you run the UnloadMacros command.*
The easiest thing to do is to put your macros in your ~/.ne directory, and make sure they don't have the same names as any built-in commands or file names you are likely to have in your current directory. If using ~/.ne is problematic, you can set your $NE_GLOBAL_DIR environment variable before starting ne. The About command shows you its current setting on the bottom line of the window.
I hope this clear up any confusion about how macros are loaded.
*It is safe to put UnloadMacros commands inside macros. If that's useful to you, I'd love to know why!