From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8GW/OuGtmmDj5wAAgWs5BA (envelope-from ) for ; Tue, 11 May 2021 18:16:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id aAVSNuGtmmCTHgAAB5/wlQ (envelope-from ) for ; Tue, 11 May 2021 16:16:33 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4E936F1FB for ; Tue, 11 May 2021 18:16:33 +0200 (CEST) Received: from localhost ([::1]:48766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgV3g-0004AH-0j for larch@yhetil.org; Tue, 11 May 2021 12:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgUzg-0006xc-5d for emacs-orgmode@gnu.org; Tue, 11 May 2021 12:12:24 -0400 Received: from mout02.posteo.de ([185.67.36.66]:42517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgUzZ-0000xk-KF for emacs-orgmode@gnu.org; Tue, 11 May 2021 12:12:23 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 7CE9A2400FE for ; Tue, 11 May 2021 18:12:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1620749533; bh=HTfEaT2J/foJ17GjCHjFuF/U2/jr9hz9UQzynY+n+zs=; h=From:To:Cc:Subject:Date:From; b=Dqzq+vABPIxGt4jF0VMajde0qEom08T9pd5FLfwnfuHmiDZSG4Z/2XZZ0PXUvgjpF FF34U/6lXQ1ia5b/MnjA7BK1d+AHJ+eMGyzh7feNmtljFjz/uXgnGmRs7/GGYHoDgl mboz/iejhHhz3aRIx/VfUANu1SDbr+Hepq68jmSpjunINkuMaj2nEfIp4XYWvVb+cT 2XzOjaa1wWY3oauMD0mMBK8eXF2qex/k1Ch8OWOqyUq+11GCkMt07IV3JmAaSuqKSm bLyS7qD96pcnjWIOIIKKsAvIkG/aqbvUlGODVzd8Ozy7+z+95NETysme9QYfrl4CAU 8ssstjEWxVvwg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FfjcD3yF6z6tmS; Tue, 11 May 2021 18:12:12 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Eric S Fraga Subject: Re: [PATCH] Possibility of using alternative separators in macros References: <87wnsjx5rs.fsf@posteo.net> <87r1id7cwb.fsf@ucl.ac.uk> Date: Tue, 11 May 2021 16:12:11 +0000 In-Reply-To: <87r1id7cwb.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Tue, 11 May 2021 12:01:08 +0100") Message-ID: <8735ut8d2c.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620749793; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=pZ8oUJc0PrrPcsYBXV/BrVouEGrJa7UNM7pTlRODVI8=; b=B5FhpFv+X7SY/aWstkUa617/YALBphiGZ4hedFOF1UoFJ4Kdqe1y8Zj45E8/dlk3Ssxq+B j3YFfArXu82ZE/1enFqabT5f1wYFgT+UowyFVBGYPYr8IK5jVjtxRJMy/W5aVUWLWZKCI2 K7mubaqLnNZjkDKc7ODFmO5DB5IGBSxs7LqmjfZz0OafO+VWWprdoJAqkYjXSTey79d8zB As1Q7zvpwbFOHnd19p637hrTb97oCTp6Bvugm/7CF+3KUxPR4JqcC6PthKa9gJI0IDu508 EV4LYrb8j2AIUUNdRxnIS4tiv6gdzSOlG6XJ/GW1CjZWl8daIq21vhSFIACl7g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620749793; a=rsa-sha256; cv=none; b=rDYGeND5ebmyTHTWXKHqO61RPAzY1kDDkB4gtuPCDaunM8gLPMLRixWuruzhNnWdL+6YpA UC6qGcpOmE3IiOJEdRgEpCDIjWfA3+jD/C7/r5fGMX+lNgUHm49saO/Vim9svaNJY+bamR Uv1wjcPovkyeB5ZAOzNe7huF6rx6BjPudC0gXR87dCV1Ptj0ludG6IJdtQgR4UikhNv+Ni 6nv++NNgsJqObRIUR3oxhbjLn6n7xhK1zA67SX2V19exa61lAcBmpoXXLe1qcr0YtVvWeJ hmJHaB3u3tvncYjvGKwy23VK41sRg+UFuDDKMxLmJzImh9ydlH+wOhindw9L1g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Dqzq+vAB; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.15 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Dqzq+vAB; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 4E936F1FB X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5yRO1PGfIBb4 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)) ;; <=3D=3D=3D=3D 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=C3=ADas 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.fsf@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=3D(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 > _) #)) ("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 () #)) > org-latex-export-as-latex(nil nil nil nil) > org-export-dispatch(nil) > funcall-interactively(org-export-dispatch nil) > command-execute(org-export-dispatch)