Breaking changes to eieio in Emacs 27?How to pass an argument to an object constructor that's NOT a slot?
bash vs. zsh: What are the practical differences?
Multiband vertical antenna not working as expected
Is it okay to have a sequel start immediately after the end of the first book?
What should I discuss with my DM prior to my first game?
How durable are silver inlays on a blade?
How (un)safe is it to ride barefoot?
Assigning function to function pointer, const argument correctness?
The significance of kelvin as a unit of absolute temperature
How to get depth and other lengths of a font?
Canada travel to US using Global Entry
Was Self-modifying-code possible just using BASIC?
What should I be wary of when insurer is taking a lot of time to decide whether car is repairable or a total loss?
Can the removal of a duty-free sales trolley result in a measurable reduction in emissions?
Why is Na5 not played in this line of the French Defense, Advance Variation?
Trying to get (more) accurate readings from thermistor (electronics, math, and code inside)
Do you have to have figures when playing D&D?
Proving that a Russian cryptographic standard is too structured
I've been given a project I can't complete, what should I do?
Flight compensation with agent
Convert only certain words to lowercase
Three questions
What differences exist between adamantine and adamantite in all editions of D&D?
A Salute to Poetry
ASCII Meme Arrow Generator
Breaking changes to eieio in Emacs 27?
How to pass an argument to an object constructor that's NOT a slot?
Q: are there breaking changes to eieio
in Emacs 27?
I just upgraded to the Emacs 27 snapshot, and I'm getting a
peculiar break in code that works in previous versions of Emacs.
walkthrough
Here's a toy class and a toy :after
method:
(defclass simple-class ()
((value
:initarg :value
:initform nil
:documentation "Test slot"))
"Test class.")
This works:
(simple-class :value "some value") ;; ==> #s(simple-class "some value")
Now I'd like to define an :after
method on initialize-instance
:
(cl-defmethod initialize-instance :after ((sc simple-class) &key)
(with-slots (value) sc
(setf value (upcase value))))
Now it's broken:
(simple-class :value "some value") ;; ==> (error "Keyword argument nil not one of nil")
NB: it's nothing about the content of the :after
method: I can
define an empty method and I get the same error.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
what happened?
So: have there been changes to eieio
(specifically,
cl-defmethod
) in Emacs 27 that break previous code? Or is there
something bizarre about the snapshot?
eieio emacs27
add a comment |
Q: are there breaking changes to eieio
in Emacs 27?
I just upgraded to the Emacs 27 snapshot, and I'm getting a
peculiar break in code that works in previous versions of Emacs.
walkthrough
Here's a toy class and a toy :after
method:
(defclass simple-class ()
((value
:initarg :value
:initform nil
:documentation "Test slot"))
"Test class.")
This works:
(simple-class :value "some value") ;; ==> #s(simple-class "some value")
Now I'd like to define an :after
method on initialize-instance
:
(cl-defmethod initialize-instance :after ((sc simple-class) &key)
(with-slots (value) sc
(setf value (upcase value))))
Now it's broken:
(simple-class :value "some value") ;; ==> (error "Keyword argument nil not one of nil")
NB: it's nothing about the content of the :after
method: I can
define an empty method and I get the same error.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
what happened?
So: have there been changes to eieio
(specifically,
cl-defmethod
) in Emacs 27 that break previous code? Or is there
something bizarre about the snapshot?
eieio emacs27
Might be incorrect use of&key
with no following arg name, I think Emacs got stricter about that. By the way, in 25.3, I getLisp error: (wrong-type-argument char-or-string-p nil)
after thecl-defmethod
, did you mean(simple-class :value "some value")
?
– npostavs
8 hours ago
Fixed the typos; sorry. Not sure how else one would define an after method without &keys here.
– Dan♦
7 hours ago
what do you think&key
means in an expression like(cl-defun foo (x &key) nil)
?
– npostavs
7 hours ago
We need the&key
to maintain the same number of arguments. Removing&key
throws an error to that effect.
– Dan♦
7 hours ago
1
C-h n
(view-emacs-news
) is usually the starting point for "What's new?".
– Drew
1 hour ago
add a comment |
Q: are there breaking changes to eieio
in Emacs 27?
I just upgraded to the Emacs 27 snapshot, and I'm getting a
peculiar break in code that works in previous versions of Emacs.
walkthrough
Here's a toy class and a toy :after
method:
(defclass simple-class ()
((value
:initarg :value
:initform nil
:documentation "Test slot"))
"Test class.")
This works:
(simple-class :value "some value") ;; ==> #s(simple-class "some value")
Now I'd like to define an :after
method on initialize-instance
:
(cl-defmethod initialize-instance :after ((sc simple-class) &key)
(with-slots (value) sc
(setf value (upcase value))))
Now it's broken:
(simple-class :value "some value") ;; ==> (error "Keyword argument nil not one of nil")
NB: it's nothing about the content of the :after
method: I can
define an empty method and I get the same error.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
what happened?
So: have there been changes to eieio
(specifically,
cl-defmethod
) in Emacs 27 that break previous code? Or is there
something bizarre about the snapshot?
eieio emacs27
Q: are there breaking changes to eieio
in Emacs 27?
I just upgraded to the Emacs 27 snapshot, and I'm getting a
peculiar break in code that works in previous versions of Emacs.
walkthrough
Here's a toy class and a toy :after
method:
(defclass simple-class ()
((value
:initarg :value
:initform nil
:documentation "Test slot"))
"Test class.")
This works:
(simple-class :value "some value") ;; ==> #s(simple-class "some value")
Now I'd like to define an :after
method on initialize-instance
:
(cl-defmethod initialize-instance :after ((sc simple-class) &key)
(with-slots (value) sc
(setf value (upcase value))))
Now it's broken:
(simple-class :value "some value") ;; ==> (error "Keyword argument nil not one of nil")
NB: it's nothing about the content of the :after
method: I can
define an empty method and I get the same error.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
what happened?
So: have there been changes to eieio
(specifically,
cl-defmethod
) in Emacs 27 that break previous code? Or is there
something bizarre about the snapshot?
eieio emacs27
eieio emacs27
edited 1 hour ago
Drew
49.5k465111
49.5k465111
asked 8 hours ago
Dan♦Dan
21.6k653114
21.6k653114
Might be incorrect use of&key
with no following arg name, I think Emacs got stricter about that. By the way, in 25.3, I getLisp error: (wrong-type-argument char-or-string-p nil)
after thecl-defmethod
, did you mean(simple-class :value "some value")
?
– npostavs
8 hours ago
Fixed the typos; sorry. Not sure how else one would define an after method without &keys here.
– Dan♦
7 hours ago
what do you think&key
means in an expression like(cl-defun foo (x &key) nil)
?
– npostavs
7 hours ago
We need the&key
to maintain the same number of arguments. Removing&key
throws an error to that effect.
– Dan♦
7 hours ago
1
C-h n
(view-emacs-news
) is usually the starting point for "What's new?".
– Drew
1 hour ago
add a comment |
Might be incorrect use of&key
with no following arg name, I think Emacs got stricter about that. By the way, in 25.3, I getLisp error: (wrong-type-argument char-or-string-p nil)
after thecl-defmethod
, did you mean(simple-class :value "some value")
?
– npostavs
8 hours ago
Fixed the typos; sorry. Not sure how else one would define an after method without &keys here.
– Dan♦
7 hours ago
what do you think&key
means in an expression like(cl-defun foo (x &key) nil)
?
– npostavs
7 hours ago
We need the&key
to maintain the same number of arguments. Removing&key
throws an error to that effect.
– Dan♦
7 hours ago
1
C-h n
(view-emacs-news
) is usually the starting point for "What's new?".
– Drew
1 hour ago
Might be incorrect use of
&key
with no following arg name, I think Emacs got stricter about that. By the way, in 25.3, I get Lisp error: (wrong-type-argument char-or-string-p nil)
after the cl-defmethod
, did you mean (simple-class :value "some value")
?– npostavs
8 hours ago
Might be incorrect use of
&key
with no following arg name, I think Emacs got stricter about that. By the way, in 25.3, I get Lisp error: (wrong-type-argument char-or-string-p nil)
after the cl-defmethod
, did you mean (simple-class :value "some value")
?– npostavs
8 hours ago
Fixed the typos; sorry. Not sure how else one would define an after method without &keys here.
– Dan♦
7 hours ago
Fixed the typos; sorry. Not sure how else one would define an after method without &keys here.
– Dan♦
7 hours ago
what do you think
&key
means in an expression like (cl-defun foo (x &key) nil)
?– npostavs
7 hours ago
what do you think
&key
means in an expression like (cl-defun foo (x &key) nil)
?– npostavs
7 hours ago
We need the
&key
to maintain the same number of arguments. Removing &key
throws an error to that effect.– Dan♦
7 hours ago
We need the
&key
to maintain the same number of arguments. Removing &key
throws an error to that effect.– Dan♦
7 hours ago
1
1
C-h n
(view-emacs-news
) is usually the starting point for "What's new?".– Drew
1 hour ago
C-h n
(view-emacs-news
) is usually the starting point for "What's new?".– Drew
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
So: have there been changes to
eieio
(specifically,cl-defmethod
) in Emacs 27 that break previous code?
It's not a change in eieio
or cl-defmethod
directly; what's changed is the handling of the &key
symbol in cl-def*
macros.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
In Emacs 26 and earlier this produces a function which accepts any number of arguments. In Emacs 27 it produces a function which accepts only one argument (sc
). The correct argument list for initialize-instance
would be like this:
(cl-defmethod initialize-instance :after ((sc simple-class) &optional slots))
As told by <f1> f initialize-instance RET
:
initialize-instance is a compiled Lisp function in ‘eieio.el’.
(initialize-instance THIS &optional SLOTS)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "583"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f50922%2fbreaking-changes-to-eieio-in-emacs-27%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So: have there been changes to
eieio
(specifically,cl-defmethod
) in Emacs 27 that break previous code?
It's not a change in eieio
or cl-defmethod
directly; what's changed is the handling of the &key
symbol in cl-def*
macros.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
In Emacs 26 and earlier this produces a function which accepts any number of arguments. In Emacs 27 it produces a function which accepts only one argument (sc
). The correct argument list for initialize-instance
would be like this:
(cl-defmethod initialize-instance :after ((sc simple-class) &optional slots))
As told by <f1> f initialize-instance RET
:
initialize-instance is a compiled Lisp function in ‘eieio.el’.
(initialize-instance THIS &optional SLOTS)
add a comment |
So: have there been changes to
eieio
(specifically,cl-defmethod
) in Emacs 27 that break previous code?
It's not a change in eieio
or cl-defmethod
directly; what's changed is the handling of the &key
symbol in cl-def*
macros.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
In Emacs 26 and earlier this produces a function which accepts any number of arguments. In Emacs 27 it produces a function which accepts only one argument (sc
). The correct argument list for initialize-instance
would be like this:
(cl-defmethod initialize-instance :after ((sc simple-class) &optional slots))
As told by <f1> f initialize-instance RET
:
initialize-instance is a compiled Lisp function in ‘eieio.el’.
(initialize-instance THIS &optional SLOTS)
add a comment |
So: have there been changes to
eieio
(specifically,cl-defmethod
) in Emacs 27 that break previous code?
It's not a change in eieio
or cl-defmethod
directly; what's changed is the handling of the &key
symbol in cl-def*
macros.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
In Emacs 26 and earlier this produces a function which accepts any number of arguments. In Emacs 27 it produces a function which accepts only one argument (sc
). The correct argument list for initialize-instance
would be like this:
(cl-defmethod initialize-instance :after ((sc simple-class) &optional slots))
As told by <f1> f initialize-instance RET
:
initialize-instance is a compiled Lisp function in ‘eieio.el’.
(initialize-instance THIS &optional SLOTS)
So: have there been changes to
eieio
(specifically,cl-defmethod
) in Emacs 27 that break previous code?
It's not a change in eieio
or cl-defmethod
directly; what's changed is the handling of the &key
symbol in cl-def*
macros.
(cl-defmethod initialize-instance :after ((sc simple-class) &key))
In Emacs 26 and earlier this produces a function which accepts any number of arguments. In Emacs 27 it produces a function which accepts only one argument (sc
). The correct argument list for initialize-instance
would be like this:
(cl-defmethod initialize-instance :after ((sc simple-class) &optional slots))
As told by <f1> f initialize-instance RET
:
initialize-instance is a compiled Lisp function in ‘eieio.el’.
(initialize-instance THIS &optional SLOTS)
answered 6 hours ago
npostavsnpostavs
7,05611237
7,05611237
add a comment |
add a comment |
Thanks for contributing an answer to Emacs Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f50922%2fbreaking-changes-to-eieio-in-emacs-27%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Might be incorrect use of
&key
with no following arg name, I think Emacs got stricter about that. By the way, in 25.3, I getLisp error: (wrong-type-argument char-or-string-p nil)
after thecl-defmethod
, did you mean(simple-class :value "some value")
?– npostavs
8 hours ago
Fixed the typos; sorry. Not sure how else one would define an after method without &keys here.
– Dan♦
7 hours ago
what do you think
&key
means in an expression like(cl-defun foo (x &key) nil)
?– npostavs
7 hours ago
We need the
&key
to maintain the same number of arguments. Removing&key
throws an error to that effect.– Dan♦
7 hours ago
1
C-h n
(view-emacs-news
) is usually the starting point for "What's new?".– Drew
1 hour ago