Hello, Aaron Ecay <aarone...@gmail.com> writes:
> Currently, if a macro is not defined, it will silently produce an empty > string while exporting. This situation could arise for example if a > macro name is acidentally mistyped. I think it’s desirable to warn the > user in this case. The attached patch introduces a function to do so, > and shows how it would be integrated in the latex backend. This raises > several questions: > > 1. Should the warning be a “message” (allows the export process to > continue) or a “user-error” (stops the export process)? Or, should > this be configurable? Certainly not a message, due to asynchronous export. > 2. Since this is a feature that many backends will want to use, should > we introduce a new “abstract” backend from which other backends can > inherit, which incorporates this feature, and others like it in the > future? The idea would be similar to prog-mode in emacs, the major > mode from which programming-language modes can derive. The > alternative is adding the (macro . org-export-macro-warn) entry > manually to all the relevant backends, and relying on future backend > authors to do the same. > > 3. Should this even be implemented as part of the backend’s > translate-alist, or at a lower level? Don't bother with export back-ends, they never get to see macros, which are expanded very early in the export process. This explains, for example, why there is no `macro' translator. You have two options. Either report an error, as you suggested, or insert an obnoxious message in the output, e.g., "UNKNOWN MACRO", à la "DEFINITION NOT FOUND." for footnote definitions. In any case, this should happen in "org-macro.el", not in the export framework. Regards, -- Nicolas Goaziou