Error fix and a few smaller enhancements
Temporary emacs buffers used during processing have not specified a coding system to use. When debugging this plugin interactively, emacs asks which coding system it should use for saving the buffer into the file. This change suppresses these questions.
This error caused the linkify hook to exit prematurely, without generating any output. The symptom was that the "*ERROR*: Not enough arguments for format string" appeared on stderr and the rendered page appeared empty. Unfortunately, it is not possible to detect this kind of errors from emacsclient status code. It is always zero.
Switch from system() to open2()
Use of system() for executing emacsclient can break ikiwiki.cgi, making the plugin incompatible with web-based editing of wiki pages and other IkiWiki functions that rely on ikiwiki.cgi.
Remove `file:' or `./' prefixes from Org links
This way, the links that are considered as in-line images by Org Mode are also correctly rendered as inline images by ikiwiki.
When ALTERNATE_EDITOR environment variable is set and emacs server is not found, emacsclient executes the editor specified by the variable. This is not what we want, because this editor might not be emacs. Therefore, we unset the variable before invoking emacsclient. Conflicts: perl/new_org.pm
Too many little changes to list, but so far it appears that things are working properly.
The perl stuff is making sense so far, let's see if we can get the emacs stuff to work.
The linkify procedure now looks at wikilinks and determines if they are images that org can display. If they are, it treats them slightly differently so that they will show up correctly on whatever page they are displayed on.
Might speed up the compilation process at the risk of using a bit more CPU.
There was a problem where the output buffer was not getting killed, and it was because I was referring to the file name rather than the name of the buffer.
Emacsclient won't call an alternate editor with command line arguments, so using the -a switch didn't work. However, it is easy to tell if it exits with an error, so we do a quick calculation with it to test if it's running and if it's not, start the daemon properly.
This function takes the output of bestlink from ikiwiki and the destpage and gives a relative path from one to the other. The page "index" is currently special-cased, because that seems to be the only page that does not build into its own directory.
Linking from the index page is now fully working as expected. The only problem is that links from post pages are broken.