Hello Eric,

It's a typo, sorry: I forgot, when I made the patch, to add the asterisk
to the `let' expression in org-element-macro-parser, therefore the `sep'
variable was not recognized.

The correct function is:

(defun org-element-macro-parser ()
    "Parse macro at point, if any.

  When at a macro, return a list whose car is `macro' and cdr
  a plist with `:key', `:args', `:begin', `:end', `:value', `:sep' and
  `:post-blank' as keywords.  Otherwise, return nil.

  Assume point is at the macro."
    (save-excursion
      (when (looking-at 
"{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\([^a-zA-Z\s()]?[^-a-zA-Z0-9_\s]?\\)\\((\\([^\000]*?\\))\\)?}}}")
        (let* ((begin (point)) ;; <==== missing asterisk :-(
               (key (downcase (match-string-no-properties 1)))
               (value (match-string-no-properties 0))
               (post-blank (progn (goto-char (match-end 0))
                                  (skip-chars-forward " \t")))
               (end (point))
               (sep (if (not (equal (match-string-no-properties 2) ""))
                        (match-string-no-properties 2)
                      ","))
               (args (pcase (match-string-no-properties 4)
                       (`nil nil)
                       (a (org-macro-extract-arguments
                           sep
                           (replace-regexp-in-string
                            "[ \t\r\n]+" " " (org-trim a)))))))
          (list 'macro
                (list :key key
                      :value value
                      :args args
                      :begin begin
                      :end end
                      :sep sep
                      :post-blank post-blank))))))

Eric S Fraga writes:

> Hello Juan,
>
> On Friday, 30 Apr 2021 at 13:26, Juan Manuel Macías wrote:
>> Hi all,
>>
>> I would like to propose (patch attached) the possibility of using an
>> alternate character for separate arguments in replacement macros,
>> following a suggestion from Nicolas Goaziou in this (closed) thread:
>> https://orgmode.org/list/87o8ead42u....@nicolasgoaziou.fr/
>
> I finally got around to trying this out, applying the patch just now to
> the latest org from the git repository.  I get the following when I try
> to export:
>
> Debugger entered--Lisp error: (void-variable sep)
>   org-element-macro-parser()
>   org-element--object-lex((bold code entity export-snippet
> footnote-reference inline-babel-call inline-src-block italic
> line-break latex-fragment link macro radio-target statistics-cookie
> strike-through subscript superscript target timestamp underline
> verbatim))
>   org-element-context()
>   org-macro-replace-all((("date" . "") ("title" . "The title")
> ("email" . "") ("author" . "Professor Eric S Fraga") ("lastchange" .
> "2021.03.31 15:03") ("calc" .
> "@@latex:{\\color{green!50!black}\\texttt{ $1 }}@@") ("cite" .
> "[[$2][@@latex:\\vfill\\Citation{$1}@@]]") ("overlay" .
> "@@latex:\\begin{textblock}{$4}($2,$3)@@[[file:$1]]@...") ("parameter"
> . "src_elisp[:results value raw :var $1=(esf/get-para...") ("constant"
> closure (t) (&optional $1 &rest _) (progn (message "Getting constant
> %s" $1) (org-table-get-constant $1))) ("input-file" . "m.org")
> ("modification-time" . #f(compiled-function (arg1 &optional arg2 &rest
> _) #<bytecode 0x1a91bc3b547f3a1c>)) ("keyword" lambda (arg1 &rest _)
> (org-macro--find-keyword-value arg1)) ("n" lambda (&optional arg1 arg2
> &rest _) (org-macro--counter-increment arg1 arg2)) ("property" lambda
> (arg1 &optional arg2 &rest _) (org-macro--get-property arg1 arg2))
> ("time" lambda (arg1 &rest _) (format-time-string arg1)))
> ("DESCRIPTION" "KEYWORDS" "SUBTITLE" "DATE" "TITLE" "DATE" "AUTHOR"))
>   org-export-as(latex nil nil nil nil)
>   org-export-to-buffer(latex "*Org LATEX Export*" nil nil nil nil nil 
> #f(compiled-function () #<bytecode 0xbb0539acd91d>))
>   org-latex-export-as-latex(nil nil nil nil)
>   org-export-dispatch(nil)
>   funcall-interactively(org-export-dispatch nil)
>   command-execute(org-export-dispatch)


Reply via email to