syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.89k forks source link

‘org-element-at-point’ cannot be used in non-Org buffer #16575

Closed tkossak closed 1 month ago

tkossak commented 1 month ago

Description :octocat:

When I press SPC j i (command spacemacs/helm-jump-in-buffer) I get multiple errors: ⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *helm org inbuffer*> (helm-major-mode)

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

System Info :computer:

tkossak commented 1 month ago

I found out that the problem is caused by (setq helm-org-format-outline-path nil) in my user-config.

tkossak commented 1 month ago

@smile13241324 what do you mean "not planned" - the bug won't be fixed?

fnussbaum commented 1 month ago

I cannot reproduce this. For me your reproduction steps succeed without errors or warnings for both values of helm-org-format-outline-path. Are your packages up to date?

smile13241324 commented 1 month ago

Sorry @tkossak I have understood your last comment that this was a user config error. If not I will reopen this issue

tkossak commented 1 month ago

I just tried to reproduce it with new spacemacs installation:

mv ~/.emacs.d ~/.emacs.d.old
mv ~/.spacemacs ~/.spacemacs.old

git clone --recursive https://github.com/syl20bnr/spacemacs ~/.emacs.d

Now copy my sample dotfile to ~/.spacemacs. Only few lines changed from default dotfile - I added org layer, removed multi cursor layer and added these 2 lines:

  (setq helm-org-format-outline-path nil)
  (setq org-startup-indented 't)

Create sample org file (eg like in first post), start Spacemacs and open the file. Press SPC j i, result: image

When I comment out the line (setq helm-org-format-outline-path nil) then it works without any errors. But it also works when I comment out only the second line (setq org-startup-indented 't), so not sure what is the culprit here.

fnussbaum commented 1 month ago

This seems to be a problem upstream in https://github.com/emacs-helm/helm-org, and should be reported there. As a workaround it should be relatively safe to ignore this warning with something like:

  (add-to-list 'warning-suppress-types 'org-element-parser)

(These warnings will still get logged to the buffer, but they will not pop up anymore.)

tkossak commented 1 month ago

Thank you. I posted it in helm-org github. The silence trick doesn't work properly for me. I added it to my spacemacs/user-config function, and now when I press SPC j i I don't get dialog (to jump to specific heading) at all. Instead I get error in status bar: Error running timer ‘org-indent-initialize-agent’: (wrong-type-argument listp org-element-parser)

For now I got rid of the option (setq org-startup-indented 't) from my dotfile.

fnussbaum commented 1 month ago

This should work:

(add-to-list 'warning-suppress-types '(org-element org-element-parser))
tkossak commented 1 month ago

This should work:

(add-to-list 'warning-suppress-types '(org-element org-element-parser))

Thank you very much, this works :)