emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Cc: emacs-orgmode@gnu.org, Thorsten Jolitz <tjolitz@gmail.com>
Subject: Re: define a new export backend
Date: Thu, 31 Jul 2014 11:17:08 +0200	[thread overview]
Message-ID: <87tx5xyjjf.fsf@geodiff-mac3.ulb.ac.be> (raw)
In-Reply-To: <87k36tkjl9.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Thu, 31 Jul 2014 10:39:46 +0200")

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Good idea, as long as `org-export-define-backend' does the same.

Oops, I forgot to remove the verbosity (initially I had wrote it as a
(warn ...)). Here's an updated patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Signal-an-error-if-keyword-is-unknown-while-defining.patch --]
[-- Type: text/x-diff, Size: 2694 bytes --]

From 117623cec251cd036b601e2481643296cc4e2c37 Mon Sep 17 00:00:00 2001
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Date: Thu, 31 Jul 2014 10:48:54 +0200
Subject: [PATCH] Signal an error if keyword is unknown while defining backends

* lisp/ox.el (org-export-define-backend):
(org-export-define-derived-backend): Signal an error if keyword is unknown
---
 lisp/ox.el | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 03bd8bb..e2965c4 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1118,14 +1118,15 @@ keywords are understood:
   (declare (indent 1))
   (let (blocks filters menu-entry options contents)
     (while (keywordp (car body))
-      (case (pop body)
-        (:export-block (let ((names (pop body)))
-			 (setq blocks (if (consp names) (mapcar 'upcase names)
-					(list (upcase names))))))
-	(:filters-alist (setq filters (pop body)))
-	(:menu-entry (setq menu-entry (pop body)))
-        (:options-alist (setq options (pop body)))
-        (t (pop body))))
+      (let ((keyword (pop body)))
+	(case keyword
+	  (:export-block (let ((names (pop body)))
+			   (setq blocks (if (consp names) (mapcar 'upcase names)
+					  (list (upcase names))))))
+	  (:filters-alist (setq filters (pop body)))
+	  (:menu-entry (setq menu-entry (pop body)))
+	  (:options-alist (setq options (pop body)))
+	  (t (error "Unknown keyword: %s" keyword)))))
     (org-export-register-backend
      (org-export-create-backend :name backend
 				:transcoders transcoders
@@ -1189,15 +1190,16 @@ The back-end could then be called with, for example:
   (declare (indent 2))
   (let (blocks filters menu-entry options transcoders contents)
     (while (keywordp (car body))
-      (case (pop body)
-	(:export-block (let ((names (pop body)))
-			 (setq blocks (if (consp names) (mapcar 'upcase names)
-					(list (upcase names))))))
-        (:filters-alist (setq filters (pop body)))
-	(:menu-entry (setq menu-entry (pop body)))
-        (:options-alist (setq options (pop body)))
-        (:translate-alist (setq transcoders (pop body)))
-        (t (pop body))))
+      (let ((keyword (pop body)))
+	(case keyword
+	  (:export-block (let ((names (pop body)))
+			   (setq blocks (if (consp names) (mapcar 'upcase names)
+					  (list (upcase names))))))
+	  (:filters-alist (setq filters (pop body)))
+	  (:menu-entry (setq menu-entry (pop body)))
+	  (:options-alist (setq options (pop body)))
+	  (:translate-alist (setq transcoders (pop body)))
+	  (t (error "Unknown keyword: %s" keyword)))))
     (org-export-register-backend
      (org-export-create-backend :name child
 				:parent parent
-- 
1.8.5.5


[-- Attachment #3: Type: text/plain, Size: 11 bytes --]


-- 
Nico.

  reply	other threads:[~2014-07-31  9:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31  7:11 define a new export backend Shiyuan
2014-07-31  7:27 ` Thorsten Jolitz
2014-07-31  8:08   ` Nicolas Richard
2014-07-31  8:39     ` Nicolas Goaziou
2014-07-31  9:17       ` Nicolas Richard [this message]
2014-07-31 11:41         ` Nicolas Goaziou
2014-07-31 22:04           ` Shiyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tx5xyjjf.fsf@geodiff-mac3.ulb.ac.be \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=tjolitz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).