From 6732d633af89737086e5b19f0c9e33bc1fbf0b6f Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 29 Apr 2012 12:17:00 +0200 Subject: [PATCH] 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. --- lisp/org-docbook.el | 2 +- lisp/org-html.el | 4 ++-- lisp/org-latex.el | 2 +- lisp/org-odt.el | 3 +-- lisp/org.el | 16 +++++++++------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index 7af766f21..cf73d1d34 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -629,7 +629,7 @@ publishing directory." (insert org-export-docbook-doctype)) (insert "\n") (insert (format "\n" - org-version emacs-major-version)) + (org-version) emacs-major-version)) (insert org-export-docbook-article-header) (insert (format "\n %s diff --git a/lisp/org-html.el b/lisp/org-html.el index 2b381dd92..bcbad612c 100644 --- a/lisp/org-html.el +++ b/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 "

" email "

\n")) (when (plist-get opt-plist :creator-info) (insert "

" - (concat "Org version " org-version " with Emacs version " + (concat "Org version " (org-version) " with Emacs version " (number-to-string emacs-major-version) "

\n"))) (insert html-validation-link "\n")) (t diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 47472bb05..9f58456ac 100644 --- a/lisp/org-latex.el +++ b/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 diff --git a/lisp/org-odt.el b/lisp/org-odt.el index 1560bbafe..cec0e8c73 100644 --- a/lisp/org-odt.el +++ b/lisp/org-odt.el @@ -2383,8 +2383,7 @@ visually." (org-odt-format-tags '("\n" . "") (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" . "") keywords) (org-odt-format-tags '("\n" . "") description) diff --git a/lisp/org.el b/lisp/org.el index 6ecfe132d..19d2aca89 100644 --- a/lisp/org.el +++ b/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