Skip to content
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

refilling trees to files will stop work in org 9.7 #1

Open
jarofromel opened this issue Apr 12, 2024 · 1 comment
Open

refilling trees to files will stop work in org 9.7 #1

jarofromel opened this issue Apr 12, 2024 · 1 comment

Comments

@jarofromel
Copy link

Hi Howard,
I found your essay about trees refactoring Refiling Trees to Files about year ago and started to use it (specifically elisp/boxes-extras.el. Thanks a lot for that!

I updated Org-mode to 9.7-pre (unconsciously as I use doom emacs) recently and the error (see next comment) appeared when I run org-subtree-metadata which uses org-element-context. I tried to find the cause and long story short Major changes and additions to Org API:

Properties and their values can now be deferred to avoid overheads
when parsing. They are calculated lazily, when the value/property is
requested by org-element-property and other getter functions. Using
plist-get to retrieve values of =PROPERTIES-PLIST= is not
recommended as deferred properties will not be resolved in such
scenario
.....
org-element-at-point, org-element-context, and
org-element-at-point-no-context may now not calculate all the
property values at the call time. Instead, the calculation will be
deferred until org-element-property or the equivalent getter
function is called. The property names may not all be calculated as
well.

I tried to include org-element-resolve-deferred (mentioned in the news) into your code but without success (to speak the truth I am not experienced emacser) and at the end I just pinned the Org-mode version to 9.6.

Good description relevant to the problem is also here (at least I think).

So now I am an happy "reuser" of your code which works. The goal of this issue is to notice you about future consequences of 9.7 version.

@jarofromel
Copy link
Author

And the debugger message:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
goto-char(nil)
(let ((header-components '(clock diary-sexp drawer headline inlinetask node-property planning property-drawer section))) (goto-char (plist-get attributes :contents-begin)) (while (let* ((cntx (org-element-context)) (elem (cl-first cntx)) (props (car (cdr cntx)))) (if (member elem header-components) (progn (goto-char (plist-get props :end)))))) (buffer-substring-no-properties (point) (org-end-of-subtree)))
org-get-subtree-content((:standard-properties [564248 564248 564282 566584 566584 0 (:title) nil element t nil 564368 566582 1 # nil nil (org-data (:standard-properties [1 1 1 601903 601903 0 nil org-data nil t nil 3 601903 nil # nil nil nil] :path "/home/random/org/capture.know.org" :CATEGORY "capture.know"))] :pre-blank 0 :raw-value [org-element-deferred org-element--headline-raw-value (2 20) nil] :title [org-element-deferred org-element-property-2 (:raw-value) nil] :level 1 :priority nil :tags ("2007mapping") :todo-keyword nil :todo-type nil :footnote-section-p [org-element-deferred org-element--headline-footnote-section-p nil nil] :archivedp [org-element-deferred org-element--headline-archivedp nil nil] :commentedp nil :DATED [org-element-deferred org-element--substring (58 80) nil] :ID [org-element-deferred org-element--substring (92 114) nil]))
(list :region (list (plist-get attrs :begin) (plist-get attrs :end)) :header (plist-get attrs :title) :tags (org-get-subtree-tags props) :properties (org-get-subtree-properties attrs) :body (org-get-subtree-content attrs))
(let* ((context (org-element-context)) (attrs (car (cdr context))) (props (org-entry-properties))) (list :region (list (plist-get attrs :begin) (plist-get attrs :end)) :header (plist-get attrs :title) :tags (org-get-subtree-tags props) :properties (org-get-subtree-properties attrs) :body (org-get-subtree-content attrs)))
(save-excursion (if (not (org-at-heading-p)) (progn (org-previous-visible-heading 1))) (let* ((context (org-element-context)) (attrs (car (cdr context))) (props (org-entry-properties))) (list :region (list (plist-get attrs :begin) (plist-get attrs :end)) :header (plist-get attrs :title) :tags (org-get-subtree-tags props) :properties (org-get-subtree-properties attrs) :body (org-get-subtree-content attrs))))
org-subtree-metadata()
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant