[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export

From: Nicolas Goaziou
Subject: Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export
Date: Sun, 28 Sep 2014 08:59:08 +0200


Aaron Ecay <address@hidden> 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.


Nicolas Goaziou

reply via email to

[Prev in Thread] Current Thread [Next in Thread]