summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-09-29 10:22:14 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2013-09-29 10:28:15 +0200
commitd745cd1952cc76fdcc164e8cb2abccb543ac1201 (patch)
tree17cfd5feaff3c6d612ea0182d51a5e6acff2a7a7
parent4cd14bd2ff29a4b8ed8e5c63ac641c3b044f15cc (diff)
downloadorg-mode-d745cd1952cc76fdcc164e8cb2abccb543ac1201.tar.gz
ox-beamer: Add a helpful error message
* lisp/ox-beamer.el (org-beamer--format-block): Return an error message when using a special environment as a block type. Also check for incomplete environment definitions.
-rw-r--r--lisp/ox-beamer.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 8ad94d1..a975d24 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -539,12 +539,14 @@ used as a communication channel."
((not env) "column")
;; Use specified environment.
(t env))))
- (env-format (unless (member environment '("column" "columns"))
- (assoc environment
- (append org-beamer-environments-special
- org-beamer-environments-extra
- org-beamer-environments-default))))
(raw-title (org-element-property :raw-value headline))
+ (env-format
+ (cond ((member environment '("column" "columns")) nil)
+ ((assoc environment
+ (append org-beamer-environments-extra
+ org-beamer-environments-default)))
+ (t (user-error "Wrong block type at a headline named \"%s\""
+ raw-title))))
(title (org-export-data (org-element-property :title headline) info))
(options (let ((options (org-element-property :BEAMER_OPT headline)))
(if (not options) ""
@@ -589,7 +591,7 @@ used as a communication channel."
(if (equal environment "column") options "")
(format "%s\\textwidth" column-width)))
;; Block's opening string.
- (when env-format
+ (when (nth 2 env-format)
(concat
(org-fill-template
(nth 2 env-format)
@@ -617,8 +619,8 @@ used as a communication channel."
(format "[%s]" raw-title))))))
"\n"))
contents
- ;; Block's closing string.
- (when environment (concat (nth 3 env-format) "\n"))
+ ;; Block's closing string, if any.
+ (and (nth 3 env-format) (concat (nth 3 env-format) "\n"))
(when column-width "\\end{column}\n")
(when end-columns-p "\\end{columns}"))))