diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-04-16 18:06:58 -0400 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2021-04-17 11:45:40 +0200 |
commit | 8e68eac0bd892fc543d80cbd76e37fcf7cf23228 (patch) | |
tree | f8683ffebe9879b8af0869d1ed77ce8d8a4ff095 | |
parent | f6139e6c54a200e5462f1dad610be51d880de16e (diff) | |
download | org-mode-8e68eac0bd892fc543d80cbd76e37fcf7cf23228.tar.gz |
macro: Do not generate macros with (&optional &rest _) signature
* lisp/org-macro.el (org-macro--makeargs): Fix Emacs-26 burping
because of a bug when functions are declared with 0 optional arguments
like (&optional &rest x).
-rw-r--r-- | lisp/org-macro.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/org-macro.el b/lisp/org-macro.el index 0f1dfa2..ea4d121 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. |