-
Notifications
You must be signed in to change notification settings - Fork 109
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
Org 9.7 org-element API incompatible changes #364
Comments
radian-software/straight.el#1107 TL;DR: If you upgraded Org mode recently, you may need to clear your straight/build directory and re-compile. |
Hello! |
Hmm. Then, may you do |
|
I see now. This is because @alphapapa Please check out https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/etc/ORG-NEWS#n40 |
@muntean-alex Meanwhile, you may need to downgrade Org mode. org-roam/org-roam#2361 has a lot of instructions how to do it. |
ISTM that this change, while it may be an improvement in several ways, is going to break a LOT of third-party packages, like this one. The org-element sexp representation has been unchanged for many years and versions. I feel like there should be a transitional period with the new representation under a different API to preserve compatibility with other code in the wild. I mean, thinking of all the places in org-ql and org-super-agenda that will likely have to be changed for this, and have multiple code paths by Org version, for YEARS to come, because of this change... the various org-ql predicates and org-super-agenda group selectors... It makes me want to import the old org-element API and just use that instead. On top of that, there is no guidance for developers to adapt their code to the new API, no helper functions or macros...? This is looking like many, many hours of work and hundreds or thousands of lines of extra code to work with multiple Org versions and APIs, and that cluttering up the packages' source code for years until the old Org versions are truly not used anymore.
Ok, so, please, please, PLEASE, do not release Org 9.7 with this change as-is. There has got to be some kind of compatibility layer for downstream libraries. This burden can't just be dumped on downstream developers and users. Or if I'm wrong and this is all much simpler than it appears, then please educate me, and please improve the documentation accordingly. |
Adam Porter ***@***.***> writes:
ISTM that this change, while it may be an improvement in several ways,
is going to break a LOT of third-party packages, like this one. The
org-element sexp representation has been unchanged for many years and
versions. I feel like there should be a transitional period with the
new representation under a different API to preserve compatibility
with other code in the wild.
Only the packages that were abusing the internal representation
_instead_ of using the (previously) existing API may be broken.
Except a single (rare) case when packages had a need to traverse all
properties in an element - this case had no proper API previously.
I mean, thinking of all the places in org-ql and org-super-agenda that
will likely have to be changed for this, and have multiple code paths
by Org version, for YEARS to come, because of this change... the
various org-ql predicates and org-super-agenda group selectors... It
makes me want to import the old org-element API and just use that
instead.
The change is not as breaking. And I do not recall where in org-ql.el sexp
representation is used.
On top of that, there is no guidance for developers to adapt their
code to the new API, no helper functions or macros...?
…--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
|
For reference, this worked for me and fixed the issue. |
I had the same issue, and I thought that it was something to do with However, downgrading
Best. |
Thanks to all for reporting. Please try the commit I just pushed on the |
Hi,
I have byte-compiled and native-compiled (I am using native-comp). I am doing something wrong but I don't see it. What is the recommended way of testing this? My org-ql is installed with Thanks. |
@gdindi You shouldn't try to mix and match files from different commits. You should follow the instructions in the readme to install with Quelpa, adding this to the recipe form: |
Makes sense. Thanks. I unistalled org-ql with
The package is installed in
I don’t understand the void function message, since the code contains the I may be introducing more noise than help in this issue. I just wanted to test seing that the OP had found another solution and that nobody seemed to have tested your fix. If I can be of any help, do not hesitate to tell me what to do, but I don’t want to pollute the issue if the problem comes from my config. Thanks. |
@gdindi Thanks for testing that. I think I made a mistake, wrapping the |
Hi. I just tried and keep getting the same error. |
Did you delete other versions of org-ql and restart Emacs before testing? |
On Tue 12-Sep-2023 at 16:16:15 +02, Adam Porter
***@***.***> wrote:
Hi. I just tried and keep getting the same error.
Did you delete other versions of org-ql and restart Emacs before testing?
Yes. I also deleted the git clone in .emacs.d/quelpa to make sure quelpa
was getting the most recent sources.
… —
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
--
|
Looking more closely at the backtrace, the element seems to have no But I also see what appear to be some still-deferred properties, which I don't understand, because we should be forcing them to resolve here: Lines 821 to 833 in 1bd7bb4
Maybe the problem is that the @gdindi Please try the commit I just pushed which changes it to use the heading marker instead. (And thank you for your help testing this!) |
I will pretend I understand your explanation ;) Good news: it works at least with my custom searches that I use most frequently. I will keep on testing in case I find other issues. Thanks! |
Adam Porter ***@***.***> writes:
Anyway, I wonder if the value of `(org-element-property :begin element)` is not what is expected even after calling `(org-element-properties-resolve node 'force-undefer)`. @yantar92 Do you happen to know off the top of your head if that is the case?
org-element does not store markers (storing markers slows down editing).
So, it is expected that :begin property is a number, not a marker.
…--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
|
Adam Porter ***@***.***> writes:
But I also see what appear to be some still-deferred properties, which I don't understand, because we should be forcing them to resolve here:
https://github.com/alphapapa/org-ql/blob/1bd7bb4af6382b00d199d9cd843fadd7e764fa82/org-ql-view.el#L821-L833
`org-element-properties-resolve' should resolve everything if it is
actually called.
Maybe the problem is that the `:begin` property was always an integer, so `org-is-habit-p` was always being called in the wrong buffer, and the error is just being revealed by `org-element-at-point` being changed to signal an error when it's not called in an `org-mode` buffer now.
Most likely.
Please try the commit I just pushed which changes it to use the heading marker instead.
FYI, in Org 9.7, `org-with-point-at' can take ELEMENT as an argument and
it will then set the buffer correctly, according to new :buffer ELEMENT
property. Not the case in earlier Org versions though.
…--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
|
@yantar92 Thanks. (And apologies for the ping; I realized afterward that I didn't need to bother you about this, but it was too late.) |
@gdindi Thanks. I'll target this change for v0.8 of org-ql, since it's not a fix per se, and since Org 9.7 is yet to be released. Please do let me know if you find any problems. |
I've pushed these fixes to master under v0.8-pre. I hope they resolve this issue, but I'll leave it open for a while in case more problems are found. To all: Please test and let me know if the problem is resolved for you. Thanks. |
I just upgraded and it appears to be working now. The org-ql query does execute and display the results as expected. Thank you! |
@kunalomizer Thanks. I don't know what's going on with that error from a timer. Line 42 in ca23b1c
But that's not called from a timer: Line 89 in ca23b1c
And I don't know what would be calling |
The error was also raised as an org-roam issue here: org-roam/org-roam#2391 |
AFAICT this is fixed. Please file a new issue if it happens again after I tag v0.8. |
@alphapapa not sure if that is expected, but the entries returned by (defun one/format (item)
(let* ((properties (cadr item))
(title (plist-get properties :raw-value))
(scheduled (plist-get properties :scheduled))
(ts (format-time-string "%FT%T%z" (org-timestamp-to-time scheduled))))
(format "%s %s" ts (or/remove-links title)))) This was broken by -(defun one/format (item)
- (let* ((properties (cadr item))
+(defun one/format (node)
+ (let* ((item (org-element-properties-resolve node 'force-undefer))
+ (properties (cadr item)) |
@TristanCacqueray The commit that resolves this issue, 8250349, resolves the deferred node properties in the function |
Good evening all,
I've had a small agenda-like org-ql setup that I used with org-mode for a while.
After not using it for a month or two, I've gotten back to using it and I've discovered that it throws an error.
"replace-regexp-in-string: Wrong type argument: stringp, [org-element-deferred org-element--headline-parse-title (nil) nil]"
Anybody facing something similar?
Any hints on tracking down this issue?
Thank you kindly!
The text was updated successfully, but these errors were encountered: