Browse Source

Make (org-version) always returns a string, use it in exporters.

* org.el (org-version): When called non-interactively, insert
the short version string, otherwise send a message with the
complete version string.

* org-odt.el (org-odt-update-meta-file): Use (org-version) and
delegate checking whether `org-version' is known as a variable
there.

* org-html.el (org-export-as-html): Use (org-version).

* org-docbook.el (org-export-as-docbook): Ditto.

* org-latex.el (org-export-latex-make-header): Ditto.
Bastien Guerry 8 years ago
parent
commit
6732d633af
5 changed files with 14 additions and 13 deletions
  1. 1 1
      lisp/org-docbook.el
  2. 2 2
      lisp/org-html.el
  3. 1 1
      lisp/org-latex.el
  4. 1 2
      lisp/org-odt.el
  5. 9 7
      lisp/org.el

+ 1 - 1
lisp/org-docbook.el

@@ -629,7 +629,7 @@ publishing directory."
 	    (insert org-export-docbook-doctype))
 	(insert "<!-- Date: " date " -->\n")
 	(insert (format "<!-- DocBook XML file generated by Org-mode %s Emacs %s -->\n"
-			org-version emacs-major-version))
+			(org-version) emacs-major-version))
 	(insert org-export-docbook-article-header)
 	(insert (format
 		 "\n  <title>%s</title>

+ 2 - 2
lisp/org-html.el

@@ -1835,7 +1835,7 @@ PUB-DIR is set, use this as the publishing directory."
 			  (split-string email ",+ *")
 			  ", "))
 	      (creator-info
-	       (concat "Org version " org-version " with Emacs version "
+	       (concat "Org version " (org-version) " with Emacs version "
 		       (number-to-string emacs-major-version))))
 
 	  (when (plist-get opt-plist :html-postamble)
@@ -1857,7 +1857,7 @@ PUB-DIR is set, use this as the publishing directory."
 		     (insert "<p class=\"email\">" email "</p>\n"))
 		   (when (plist-get opt-plist :creator-info)
 		     (insert "<p class=\"creator\">"
-			     (concat "Org version " org-version " with Emacs version "
+			     (concat "Org version " (org-version) " with Emacs version "
 				     (number-to-string emacs-major-version) "</p>\n")))
 		   (insert html-validation-link "\n"))
 		  (t

+ 1 - 1
lisp/org-latex.el

@@ -1522,7 +1522,7 @@ OPT-PLIST is the options plist for current buffer."
      (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n  pdfcreator={%s}}\n"
          (org-export-latex-fontify-headline keywords)
          (org-export-latex-fontify-headline description)
-	 (concat "Emacs Org-mode version " org-version))
+	 (concat "Emacs Org-mode version " (org-version)))
      ;; beginning of the document
      "\n\\begin{document}\n\n"
      ;; insert the title command

+ 1 - 2
lisp/org-odt.el

@@ -2383,8 +2383,7 @@ visually."
        (org-odt-format-tags '("\n<meta:generator>" . "</meta:generator>")
 			    (when org-export-creator-info
 			      (format "Org-%s/Emacs-%s"
-				      (if (boundp 'org-version) org-version
-					"Unknown")
+				      (org-version)
 				      emacs-version)))
        (org-odt-format-tags '("\n<meta:keyword>" . "</meta:keyword>") keywords)
        (org-odt-format-tags '("\n<dc:subject>" . "</dc:subject>") description)

+ 9 - 7
lisp/org.el

@@ -218,13 +218,15 @@ With prefix arg HERE, insert it at point."
   (let* ((origin default-directory)
 	 (version (if (boundp 'org-release) org-release "N/A"))
 	 (git-version (if (boundp 'org-git-version) org-git-version "N/A"))
-	 (org-install (ignore-errors (find-library-name "org-install"))))
-    (setq version (format "Org-mode version %s (%s @ %s)"
-			  version
-			  git-version
-			  (if org-install org-install "org-install.el can not be found!")))
-    (if here (insert version))
-    (message version)))
+	 (org-install (ignore-errors (find-library-name "org-install")))
+	 (version_ (format "Org-mode version %s (%s @ %s)"
+			   version
+			   git-version
+			   (if org-install org-install "org-install.el can not be found!"))))
+    (if (org-called-interactively-p 'interactive)
+	(if here (insert version_)
+	  (message version_))
+      version)))
 
 ;;; Compatibility constants