From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-orgmode@gnu.org
Subject: Re: Improving org-macro.el
Date: Fri, 16 Apr 2021 18:06:58 -0400 [thread overview]
Message-ID: <jwveef9evji.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87y2diffqi.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Fri, 16 Apr 2021 16:47:49 +0200")
> I mentioned it in the ORG-NEWS file, and applied your changes. We'll see
> how it goes.
I just saw that it burps in Emacs-26 because of a bug when functions are
declared with 0 optional arguments like (&optional &rest x).
So I suggest the patch below,
Stefan
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 0f1dfa2e48..ea4d12133b 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -91,10 +91,11 @@ directly, use instead:
(setq i (match-end 0))
(setq max (max max (string-to-number (match-string 1 template)))))
(let ((args '(&rest _)))
- (while (> max 0)
- (push (intern (format "$%d" max)) args)
- (setq max (1- max)))
- (cons '&optional args))))
+ (if (< max 1) args ;Avoid `&optional &rest', refused by Emacs-26!
+ (while (> max 0)
+ (push (intern (format "$%d" max)) args)
+ (setq max (1- max)))
+ (cons '&optional args)))))
(defun org-macro--set-templates (templates)
"Set template for the macro NAME.
next prev parent reply other threads:[~2021-04-16 22:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 17:17 Improving org-macro.el Stefan Monnier
2021-04-16 14:47 ` Nicolas Goaziou
2021-04-16 16:22 ` Stefan Monnier
2021-04-16 22:06 ` Stefan Monnier [this message]
2021-04-17 9:48 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwveef9evji.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.