master 300deca4a8f: Fix error in `cl-defstruct' when slot names contain % characters
Sean Whitton <[email protected]> Thu, 9 Jul 2026 06:55:47 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: master commit 300deca4a8ff627efe081e7b5b48b8d78810e6e7 Author: David Ponce <[email protected]> Commit: Sean Whitton <[email protected]> Fix error in `cl-defstruct' when slot names contain % characters * lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Escape % in slot names. (cl-defstruct): Do not pass again to `format' an already formatted doc string. --- lisp/emacs-lisp/cl-macs.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 9fa2a2b7cf0..2cc9b169314 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -694,8 +694,10 @@ its argument list allows full Common Lisp conventions." (setq ,var nil)) (t (error - ,(format "Keyword argument %%S not one of %S" - keys) + ,(format "Keyword argument %%S not one of %s" + ;; Escape % in slot names. + (string-replace "%" "%%" + (format "%S" keys))) (car ,var))))))) (push `(let ((,var ,restarg)) ,check) cl--bind-forms))))) (cl--do-&aux args) @@ -3293,8 +3295,9 @@ To see the documentation for a defined struct type, use ;; the parent's accessor? (push `(define-inline ,accessor (x) ,(let ((long-docstring - (format "Access slot \"%s\" of `%s' struct X." - slot name))) + (internal--format-docstring-line + "Access slot \"%s\" of `%s' struct X." + slot name))) (concat ;; NB. This will produce incorrect results ;; in some cases, as our coding conventions @@ -3315,7 +3318,7 @@ To see the documentation for a defined struct type, use "\n" (internal--format-docstring-line "Struct X is a `%s'." name)) - (internal--format-docstring-line long-docstring)) + long-docstring) (if doc (concat "\n" doc) "") "\n" (format "\n\n(fn %s X)" accessor)))