To save time, we don't re-initialize the list of projects/files each
time a file is published. But if people want to publish a file that
they just created, this file is not part of any project until the
list of project/files has been re-initialized.
If the file is not part of a project and should be, then the user
can tell so.
Throw an error when `org-publish-current-file' is called on a file that
is not part of any project. Publishing a single file that is not part
of a project is already done by simply exporting it, so the user should
be warned about this.
There are now two hooks:
`org-publish-before-export-hook'
`org-publish-after-export-hook'.
`org-publish-org-to' deal with killing buffers (instead of
`org-publish-file')
Whether a buffer is created or not depends on publishing functions such
as `org-export-as-html' and the like. But not all such functions create
a new buffer (e.g. `org-publish-attachment'), so we need to delete the
buffer if it differs from the last buffer we we're in before export.
`org-publish-delete-duplicates' was misleading because of the
distinction between `delete-dups' and `delete-duplicates'.
Also fix a bug in the interaction of `org-publish' and
`org-publish-current-project'.
In (< emacs-major-version 2), there is no `delete-dups'.
So we use this alias, either calling `delete-dups' or
using a routine copyied from subr.el in Emacs 22+.