[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 |
Hello,
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.
Regards,
--
Nicolas Goaziou
- [O] [RFC] [PATCH] Warn about unexpanded macros on export, Aaron Ecay, 2014/09/19
- Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export, Nicolas Goaziou, 2014/09/23
- Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export, Aaron Ecay, 2014/09/27
- Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export,
Nicolas Goaziou <=
- Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export, Rasmus, 2014/09/23
- Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export, Aaron Ecay, 2014/09/28
- Re: [O] [RFC] [PATCH] Warn about unexpanded macros on export, Nicolas Goaziou, 2014/09/28