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

(wrong-type-argument number-or-marker-p nil) when "clicking" Org mode link with embark-act #723

Open
dschrempf opened this issue Jun 8, 2024 · 10 comments

Comments

@dschrempf
Copy link

Hi!

When I click a link in Org mode with embark-act, I get the following backtrace:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  embark-org-target-element-context()
  #f(compiled-function (fun) #<bytecode 0x551bde5be1cc115>)(embark-org-target-element-context)
  embark--targets()
  embark-act(nil)
  funcall-interactively(embark-act nil)
  command-execute(embark-act)

This error only has shown up recently, but of course it may be due to my specific setup. Let me know if I can provide more details or should try with emacs- Q.

@idlip
Copy link

idlip commented Jun 10, 2024

Same here with emacs -Q.

I guess new org version 9.7 has some changes related to org element.

@idlip
Copy link

idlip commented Jun 11, 2024

Its weird. yantar on matrix confirmed that its not happending.

So I eval the embark-org buffer, and it worked as expected.

Not sure what is causing this. Yantar pointed out something to do with native comp, so as I use nix to manage emacs packages, update or recompiling may solve it.

@dschrempf
Copy link
Author

That's right! When I evaluate the embark-org buffer, it starts working.

However, and this is weird: When I evaluate

(with-eval-after-load 'org
  (require 'embark-org))

which is the last bit of embark.org, it still does NOT work. I guess this is because it loads the byte compiled file.

So I went ahead, and byte-compiled embark-org.el, and lo and behold the byte compiled files differ. I have no idea how to diff them or what's the reason for the difference... I am also using Nix, so should we report this upstream?

@oantolin
Copy link
Owner

I'm sorry, I don't think I understand what could cause this other than it seems like maybe it's some sort of installation problem? After installing Org 9.7, I reinstalled every package with an org dependency, just in case and have had no problems.

@dschrempf
Copy link
Author

To be honest, I suspect this being a problem within Nix. For example, it could be that the Emacs used to byte-compile the file is not yet using Org mode 9.7? I will poke around further.

@idlip
Copy link

idlip commented Jun 24, 2024

Hey @dschrempf , there is no issue with recent update.

@dschrempf
Copy link
Author

@idlip which update are you referring to? I am still observing this problem, but I think it is unrelated to embark. It seems to be Nix-specific.

@idlip
Copy link

idlip commented Jun 25, 2024 via email

@dschrempf
Copy link
Author

dschrempf commented Jun 25, 2024

Hm, I am still observing this, even after updating emacs-overlay.

@hpfr
Copy link

hpfr commented Jul 8, 2024

I was getting this error with Guix packages. Debugging the byte-compiled embark-org-target-element-context, it becomes clear that it was compiled with an org-element-property that is a defsubst calling plist-get, which was the case in Org 9.6. But in Org 9.7, org-element-property becomes more complex. :begin is moved into an array of “standard properties”, presumably for performance reasons. This causes the naïve plist-get to fail when operating on values returned from org-element-lineage from Org 9.7 (which you presumably have installed via Nix).

Like Guix, I suspect this mismatch is because the Nix package for Embark doesn’t list the standalone Org package as an input, so compilation of embark-org is done with the Org shipped with Emacs 29, so embark-org-target-element-context ends up calling plist-get instead of the more substantial Org 9.7 org-element-property.

I fixed it by overriding my Embark package to include Org 9.7 as an input. Presumably you could do similarly in an overlay.

This is a clash between Guix/Nix’s attempts at hermetic builds and Emacs shipping with a bunch of packages that people like to upgrade to the lastest standalone versions. We could add the newer, standalone Org package as a propagated input for any dependents like Embark, but some Embark users might not use Org. So maybe Guix/Nix should package embark-org separately and declare the propagated input there. But maybe some users prefer to stick with the Org version embedded in Emacs? So it’s tough. Definitely a packaging concern rather than an Embark issue, though.

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

4 participants