From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: Re: define a new export backend Date: Thu, 31 Jul 2014 11:17:08 +0200 Message-ID: <87tx5xyjjf.fsf@geodiff-mac3.ulb.ac.be> References: <87bns69eeo.fsf@gmail.com> <877g2uymqh.fsf@geodiff-mac3.ulb.ac.be> <87k36tkjl9.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCmSA-0001V5-By for emacs-orgmode@gnu.org; Thu, 31 Jul 2014 05:15:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCmS4-0006tP-Ha for emacs-orgmode@gnu.org; Thu, 31 Jul 2014 05:15:14 -0400 Received: from mxin.ulb.ac.be ([164.15.128.112]:53240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCmS4-0006so-Bp for emacs-orgmode@gnu.org; Thu, 31 Jul 2014 05:15:08 -0400 In-Reply-To: <87k36tkjl9.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Thu, 31 Jul 2014 10:39:46 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Richard Cc: emacs-orgmode@gnu.org, Thorsten Jolitz --=-=-= Content-Type: text/plain Nicolas Goaziou 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Signal-an-error-if-keyword-is-unknown-while-defining.patch >From 117623cec251cd036b601e2481643296cc4e2c37 Mon Sep 17 00:00:00 2001 From: Nicolas Richard 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 --=-=-= Content-Type: text/plain -- Nico. --=-=-=--