-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add copy-tree #25
Add copy-tree #25
Conversation
Thanks!
I copied the tests from |/test/lisp/subr-tests.el|. Would it be
appropriate to indicate that the tests were copied from Emacs?
Yes, a short comment is appropriate. However many tests are copied from
Emacs. At some point we should think about possibly synchronizing the
test suites.
The CI is currently failing on old Emacs versions due to invalid
literals. Records have been introduced in 26.1. The test suite should
make sure that it tests the degraded functionality on Emacs < 26.1
gracefully.
|
Done.
This sounds like a good idea! Although in this case, it wouldn't work... |
I see now that I forgot to change the final literal. Fixed in the latest force-push. But... IIUC the printed representation of structs are different pre- and post-26, so I'm not sure how to do this without a conditional.
If the latest force-push doesn't work, could we keep the existing test which uses According to Stefan , "[copy-tree] used to [work with structs] |
Yes, using the printed representation for the test is not ideal. You could still use a condition
That's right. But our test suite should cover all the supported Emacs versions in any case. |
Okay! What would the string representation be for pre 26 versions? |
Run Emacs 25 :) |
You could just guess the representation by looking at the old |
Thanks, I'll do that. I was not looking forward to building Emacs 25. |
Joseph Turner ***@***.***> writes:
> You could just guess the representation by looking at the old
`cl-defstruct` definition. I suspect it was just the vector
representation, e.g., `[foo ...]` for a `foo` struct, but I haven't
checked.
Thanks, I'll do that. I was not looking forward to building Emacs 25.
In case you use Guix, you can build older versions using these
package definitions:
https://git.sr.ht/~pkal/guix-emacs-historical
If not, I can build it for you and send you a portable tarball.
|
Thank you!! This looks like a useful resource. The pre-26 representation is |
@phikal Could you make these portable tarballs available somewhere, ideally signed? |
Daniel Mendler ***@***.***> writes:
@phikal Could you make these portable tarballs available somewhere, ideally signed?
I could try it, but 1. I've never done that before, 2. I don't have the
storage to host these files myself (the storage is not insignificant,
since it contains Emacs and all the dependencies).
|
It looks like the problem now is that the pre-26 versions are failing due to https://github.com/emacs-compat/compat/actions/runs/5043804459/jobs/9046066759?pr=25#step:6:66 Since |
No, I would oppose that. We can either define a compatibility predicate |
Okay, will do. |
I agree with Philip. Also we should not add |
A number of our tests are more extensive than what Emacs has, which is the reason why the core has expressed interest in copying our code. So there is certainly potential for collaboration here. |
I have wrapped the body of
and replaced The backtrace now shows an error at |
@josephmturner Thanks. I am trying to investigate the problem now. |
Joseph Turner ***@***.***> writes:
I have wrapped the body of `compat--copy-tree` with
```
(let ((compat--recordp (if (fboundp #'recordp)
#'recordp
#'always))
...)
```
There is no reason to make this complicated like this, just do
(or (not (fboundp 'recordp)) (recordp ...))
Also, remember not to sharp-quote a function symbol you are checking
with `fboundp', because the point is that it might very well not be bound.
and replaced `(recordp ...)` with `(funcall compat--recordp ...)`.
The backtrace [now shows an error](https://github.com/emacs-compat/compat/actions/runs/5044001888/jobs/9046525846?pr=25#step:6:41) at `(length (setq tree (copy-sequence tree)))`.
Related to this, I am also not a fan of using `cl-labels' here either.
A little bit of duplication is the safer tactic, IMO.
|
It seems we should avoid using the printed representation for the tests.
I merged this for now, with some more basic tests added, avoiding the printed representation. Regarding the |
Good catch. Thank you! |
Thank you!! I learned a lot working with you two today :) |
Joseph, thank you, for the addition to both Emacs proper and Compat! |
Resolves #24.
I copied the tests from
/test/lisp/subr-tests.el
. Would it be appropriate to indicate that the tests were copied from Emacs? Perhaps you'd prefer shorter tests?