From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [RFC] [PATCH] Warn about unexpanded macros on export Date: Sun, 12 Oct 2014 16:48:45 +0100 Message-ID: <87d29xi90i.fsf@gmail.com> References: <87k34zqv9r.fsf@gmail.com> <87bnqbv27b.fsf@nicolasgoaziou.fr> <87fvfjow6p.fsf@gmail.com> <87lhpaf5lq.fsf@nicolasgoaziou.fr> <8738bcmme5.fsf@gmail.com> <874mvsxmbn.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdLOF-0006yN-H2 for emacs-orgmode@gnu.org; Sun, 12 Oct 2014 11:49:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdLO5-0005mt-UW for emacs-orgmode@gnu.org; Sun, 12 Oct 2014 11:48:59 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:37700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdLO5-0005mY-NU for emacs-orgmode@gnu.org; Sun, 12 Oct 2014 11:48:49 -0400 Received: by mail-wi0-f178.google.com with SMTP id h11so1764821wiw.17 for ; Sun, 12 Oct 2014 08:48:48 -0700 (PDT) In-Reply-To: <874mvsxmbn.fsf@nicolasgoaziou.fr> 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 Goaziou , Org-mode Hi Nicolas, 2014ko irailak 28an, Nicolas Goaziou-ek idatzi zuen: > > Hello, > > Aaron Ecay writes: > >> Attached is a revised patch. WDYT? > > Looks good. Some small comments follow. > >> + (if value >> + (progn >> + (push signature record) >> + (delete-region >> + begin >> + ;; Preserve white spaces after the macro. >> + (progn (goto-char (org-element-property :end object)) >> + (skip-chars-backward " \t") >> + (point))) >> + ;; Leave point before replacement in case of recursive >> + ;; expansions. >> + (save-excursion (insert value))) >> + (when finalize >> + (error "Macro %s was undefined at line %s" >> + (org-element-property :key object) >> + (line-number-at-pos)))))))))))) > > Nitpick: I find the following more readable > > (cond (value (push signature record) > ...) > (finalize (error ...))) > > Also, don't provide error line as macro are replaced after include > keywords are expanded. IOW, in some cases, the line number will be > misleading. The key is sufficient, e.g., > > (error "Undefined Org macro: %s. Aborting" > (org-element-property :key object)) > > You can commit it once this is fixed. Thank you for the patch. Pushed; thanks for the feedback. -- Aaron Ecay