فهرست منبع

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.
Bastien Guerry 17 سال پیش
والد
کامیت
9df93e8698
3فایلهای تغییر یافته به همراه23 افزوده شده و 11 حذف شده
  1. 3 0
      ChangeLog
  2. 16 10
      ORGWEBPAGE/Changes.org
  3. 4 1
      org-publish.el

+ 3 - 0
ChangeLog

@@ -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)

+ 16 - 10
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.
 

+ 4 - 1
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))