-
Notifications
You must be signed in to change notification settings - Fork 15
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
Emacs 28 cl-struct change breaks ts-fill #18
Comments
Thanks for reporting. It's not practical for me to test that specific build of Emacs 28; can you reproduce it on Emacs 27.2 or on a master-branch build of Emacs 28.0? |
I'm able to reproduce with the above recipe on the master branch of Emacs 28 but it does not happen in the latest build of Emacs 27.2.50 |
This is more of a generic question, but how do you go about debugging |
Before we go any further, it's possible this is a macro-expansion issue due to struct-related changes in different Emacs versions. Are you sharing any config between these different versions? I'd recommend using my |
If the problem does occur with clean configurations, then it's probably happening due to some kind of internal struct-related changes in Emacs 28. To see what's happening, you could If that doesn't help, I can add a debug declaration to make it work with |
some further observations. It seems like the ts struct is slightly different between the two versions. The ;; Emacs 28.0.50
(nth 1 (cl-struct-slot-info 'ts))
;; =>
;; (hour
;; nil
;; :type integer
;; (:accessor-init string-to-number
;; (format-time-string
;; "%H"
;; (ts-unix struct)))
;; (:aliases H)
;; (:constructor . "%H"))
;; Emacs 27.2.50
(nth 1 (cl-struct-slot-info 'ts))
;; =>
;; (hour
;; nil
;; :type integer
;; :accessor-init (string-to-number
;; (format-time-string
;; "%H"
;; (ts-unix struct)))
;; :aliases (H)
;; :constructor "%H")
which I've tracked to this commit on master emacs-mirror/emacs@3788d22. With the introduction of After way too much time due to my lack of familiarity, I believe this works with a clean version of Emacs 28.0.50 after the above commit: diff --git a/ts.el b/ts.el
index c36443f..43f3a6e 100644
--- a/ts.el
+++ b/ts.el
@@ -398,15 +398,15 @@ to `make-ts'."
(defmacro ts-define-fill ()
"Define `ts-fill' function that fills all applicable slots of `ts' object from its `unix' slot."
(let* ((slots (->> (cl-struct-slot-info 'ts)
- (--select (and (not (member (car it) '(unix internal cl-tag-slot)))
- (plist-get (cddr it) :constructor)))
+ (--select (and (not (member (car it) '(unix internal cl-tag-slot)))
+ (alist-get :constructor (cddr it))))
- (--map (list (intern (concat ":" (symbol-name (car it))))
- (cddr it)))))
+ (--map (list (intern (concat ":" (symbol-name (car it))))
+ (cddr it)))))
(keywords (-map #'car slots))
(constructors (->> slots
- (--map (plist-get (cadr it) :constructor))
- -non-nil))
+ (--map (alist-get :constructor (cadr it)))
+ -non-nil))
(types (--map (plist-get (cadr it) :type) slots))
(format-string (s-join "\f" constructors))
(value-conversions (cl-loop for type in types I'm assuming something that would check the emacs version and using plist-get or alist-get as necessary would be the right move. EDIT: sorry for the change in formatting/indentation above. I'm not sure why mine would differ from yours. |
I actually built two clean versions of emacs after you had mentioned it. I ended up just changing the respective |
Wow, you're fast. :) Tracking it down to the commit is great, and that is recent, indeed. I wish this kind of change wasn't made, but I don't know if the way I'm using internal struct details is, well, allowed. I'm guessing Stefan might frown on it, and he's probably making this change for a good reason. OTOH, I guess that this will break existing Emacs configs, as it broke yours, so it would require users to upgrade So it might be worth asking him about it, since the change hasn't made it to a released Emacs version yet. What do you think? Thanks for all your work on this. I don't usually run Emacs master builds, so this could have gone unnoticed until it released, which would have been an unpleasant surprise. |
(I'm going to try this newfangled--to me--transfer feature, to try to move this issue to the |
...Seems to have worked... |
This may fail on Emacs 28.0.50. See <#18>.
Added GitHub Actions CI, which will test with Emacs 28: 099ec36 |
Will help with testing ts-fill, see <#18> (though this argument should have been added originally).
The test for |
And running the tests on CI reveals that |
Another thing related to the Emacs 28 cl struct. I get a lot of these near-identical warnings on compiling my package. Doesn't happen on Emacs 27.
And so on ad infinitum. If it matters, I use ts-fill simply for inspectability, no programmatic purpose. |
@meedstrom Yes, I've seen those when I've tested on Emacs 28 at times recently. I hope it's fixable, but I haven't had time to look into it yet. |
I reported this as https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50214. I doubt they'll be willing to back out the change, but at least we'll have it documented. |
Today Lars followed up on that report and made me aware of Philip Stefani's suggestion, which would be simpler and more future-proof than the current implementation:
I think that should work, and if I define it as an inline function, it should be similarly optimized. So that is the current plan. |
Hello,
I have noticed that I'm no longer able to use any org-ql-view that relies on evaluating a timestamp.
You should be able to replicate this with the following
emacs -Q -l
I think I've narrowed it down to the fact that
ts-fill
does not seem to fill the relevant slots based on the unix timestamp. Perhaps this is better suited to be an issue in ts.el but I figured you are more active here.I'm using
GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
Specifically the flatwhatson's pgtk-native-comp branch
emacs-pgtk-native-comp 28.0.50-197.e288348
The text was updated successfully, but these errors were encountered: