From 9df93e869829c0d5a618b37134922a0904699042 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 10 Mar 2008 11:39:01 +0000 Subject: [PATCH 1/2] 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. --- ChangeLog | 3 +++ ORGWEBPAGE/Changes.org | 26 ++++++++++++++++---------- org-publish.el | 5 ++++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ad49dc9c..12fe15694 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-03-10 Bastien Guerry + * 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 2a8220655..d8f699225 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 0385a3774..09110061d 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)) From 8891396992860a0550811caeccb2f7e8462c90f4 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 10 Mar 2008 15:18:27 +0000 Subject: [PATCH 2/2] Fixed typo about missing @. --- org.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.texi b/org.texi index 1ec905465..11bec462c 100644 --- a/org.texi +++ b/org.texi @@ -4405,7 +4405,7 @@ forgot to call you father for 3 weeks, it does not make sense to call her 3 times in a single day to make up for it. Finally, there are tasks like changing batteries which should always repeat a certain time @i{after} the last time you did it. For these tasks, Org-mode has -special repeaters markes with @samp{++} and samp{.+}. For example: +special repeaters markes with @samp{++} and @samp{.+}. For example: @example ** TODO Call Father