diff options
author | Bastien Guerry <bzg@altern.org> | 2008-03-10 11:39:01 +0000 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2008-03-10 11:39:01 +0000 |
commit | 9df93e869829c0d5a618b37134922a0904699042 (patch) | |
tree | 778b747eaf0fdd0e842d08450256a2fea6c2b29c | |
parent | 06fb98f1e24be61e598172f3293a4e9a40134b43 (diff) | |
download | org-mode-9df93e869829c0d5a618b37134922a0904699042.tar.gz |
Bugfix in org-publish.el.
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.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | ORGWEBPAGE/Changes.org | 26 | ||||
-rw-r--r-- | org-publish.el | 5 |
3 files changed, 23 insertions, 11 deletions
@@ -1,5 +1,8 @@ 2008-03-10 Bastien Guerry <bzg@altern.org> + * org-publish.el (org-publish-file): Send an error when file is + not part of any project. + * org.el (org-select-remember-template): Cleaned the code. * org-publish.el (org-publish-before-export-hook) diff --git a/ORGWEBPAGE/Changes.org b/ORGWEBPAGE/Changes.org index 2a82206..d8f6992 100644 --- a/ORGWEBPAGE/Changes.org +++ b/ORGWEBPAGE/Changes.org @@ -66,21 +66,27 @@ *** New template option: pre-selection contexts - Templates now allow six elements. The last element defines - the contexts in which the template should be offered. It - can be a list of major modes, a function, `t' or `nil'. If - it is a list of major-mode, the template will be available - only when `org-remember' is called from a buffer in one of - these modes. If it is a function, the template will be - offered only if the function returns `t' when called in the - current buffer. A value of `t' for this element means - select this template in any context. `nil' means use this - template by default, when other checks failed. + contexts in which the template should be offered. + + A context is either a list of major modes or a function. + When calling `org-remember' from a buffer, if the buffer is + in one of the major modes listed in a template's context or + if a context-function returns `t' in the buffer, then the + template will be selected. Templates not associated with + any contexts will be *always* offered for selection. For + exemple: (setq org-remember-templates '(("Org" ?o "* %a\n\n%i%?" "~/org/bzg.org" "Org" my-defun))) M-x org-remember RET will present this template only if - calling `my-defun' in the current buffer returns `nil'. + calling `my-defun' in the current buffer returns `t. + + (setq org-remember-templates + '(("Org" ?o "* %a\n\n%i%?" "~/org/bzg.org" "Org" (org-mode)))) + + M-x org-remember RET will present this template only if + we are in an Org-mode buffer. The (info "(org)Remember templates") for details. diff --git a/org-publish.el b/org-publish.el index 0385a37..0911006 100644 --- a/org-publish.el +++ b/org-publish.el @@ -516,7 +516,10 @@ FILENAME is the filename of the file to be published." (defun org-publish-file (filename &optional project) "Publish file FILENAME from PROJECT." (when (org-publish-needed-p filename) - (let* ((project (or project (org-publish-get-project-from-filename filename))) + (let* ((project (or project + (or (org-publish-get-project-from-filename filename) + (error "File %s is not part of any known project" + filename)))) (project-plist (cdr project)) (publishing-function (or (plist-get project-plist :publishing-function) 'org-publish-org-to-html)) |