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

helm-org-ql: void-function peg-parse-string #75

Closed
novoid opened this issue Dec 17, 2019 · 18 comments
Closed

helm-org-ql: void-function peg-parse-string #75

novoid opened this issue Dec 17, 2019 · 18 comments

Comments

@novoid
Copy link

novoid commented Dec 17, 2019

After installing org-ql-20191207.408 via use-package (yes, I switched from GitHub version to use-package because of list of dependencies) I get this when invoking helm-org-ql:

Error running timer: (error "In ‘helm-org-ql’ source: ‘#[0 \\303	!\\304\\305 !�\\205%\0r\\306 q\\210\\300�)\\3071#\0\\310\\300�\\311\\312�D$0\\202%\0\\210\\313\\207 [issues.org helm-pattern helm-org-ql-buffers-files org-ql--plain-query window-width helm-window helm-buffer-get (error) org-ql-select :action helm-org-ql--heading nil] 8]’ 
 (void-function peg-parse-string)")

Initial tests of org-ql-search do seem to work though.

Some package versions I do think might be involved:

  • helm-org-20191214.802
  • org-ql-20191207.408
  • ts-20191010.210
  • peg-1.0
  • ov-20191127.32
  • dash-functional-20191109.1327
  • org-sidebar-20191012.514
@alphapapa
Copy link
Owner

Hi Karl,

Just FYI, use-package doesn't install packages. The :ensure t keyword argument to the macro causes it to attempt to ensure the package is installed using the built-in package.el. The distinction can be important, because, e.g. there are other ways that use-package can cause packages to be installed, e.g. with quelpa-use-package, straight.el, etc, which provide use-package keyword add-ons and don't use package.el as a backend to install a package.

That error indicates that the peg package is not installed. I would recommend uninstalling org-ql completely (e.g. you could use this function: https://github.com/alphapapa/unpackaged.el#delete-all-installed-versions-of-a-package), then restart Emacs, then reinstall org-ql and ensure that there are no errors from the full installation process, which should include dependencies.

@alphapapa
Copy link
Owner

By the way, you might find this script helpful for testing Emacs in a clean configuration: https://github.com/alphapapa/alpha-org/blob/master/emacs-sandbox.sh

@novoid
Copy link
Author

novoid commented Dec 17, 2019

You're a true Emacs wizard.

I used your script to remove org-sidebar, org-ql, and peg. Out of curiosity I just re-started Emacs to find out if use-package is able to install it cleanly this time. And yes, it works now, even solves #76 as you already knew.

Related to your FYI: I already knew that use-package with :ensure t uses package.el to install. What was the difference between the first install of line and the second after deleting the packages? And why was there a peg-1.0 folder in my elpa directory? Or was v1.0 simply too old?

Thanks for your explanations!

@novoid novoid closed this as completed Dec 17, 2019
@alphapapa
Copy link
Owner

You're a true Emacs wizard.

I'm a noob compared to the real wizards. ;)

I used your script to remove org-sidebar, org-ql, and peg. Out of curiosity I just re-started Emacs to find out if use-package is able to install it cleanly this time. And yes, it works now, even solves #76 as you already knew.

Great!

Related to your FYI: I already knew that use-package with :ensure t uses package.el to install. What was the difference between the first install of line and the second after deleting the packages? And why was there a peg-1.0 folder in my elpa directory? Or was v1.0 simply too old?

I don't know what the problem was, but chances are it was due to outdated packages with stale .elc files that Emacs was loading in preference to the newer versions; it's a common issue. Or perhaps one of the packages failed to install at some time in the past, and it wasn't noticed until now. Deleting old versions and installing newer ones usually fixes things like that.

If that happens again, it may indicate a kind of configuration problem. You might want to redo the part of your config that configures the package system, load-path, etc.

Thanks for your explanations!

The least I can do for someone like you who contributes so much to the Emacs/Org community!

@novoid
Copy link
Author

novoid commented Dec 17, 2019

Something's fishy here. I get this again:

org-ql-block is an alias for ‘org-ql-search-block’, which is not defined.

I get rid of org-ql and peg using your function, restart emacs, packages get fetched and installed, everything's working fine. The I restart emacs and the error re-appears.

Could it be related to the order I load the packages? I committed my recent changes, if you need to take a look: https://github.com/novoid/dot-emacs/blob/master/config.org

Having re-started my emacs for a couple of hundred times today, I'm happily volunteering in debugging this, if this helps.

@alphapapa
Copy link
Owner

I get rid of org-ql and peg using your function, restart emacs, packages get fetched and installed, everything's working fine. The I restart emacs and the error re-appears.

When exactly does the error appear? Simply after restarting Emacs, without actually doing anything in Emacs?

Could it be related to the order I load the packages?

Probably, yes. Try loading org-ql before anything that might use it or the agenda.

@yantar92
Copy link
Contributor

Having re-started my emacs for a couple of hundred times today, I'm happily volunteering in debugging this, if this helps.

As a blind shot, could you try setting load-prefer-newer to t before (package-initialize)?

@rieje
Copy link

rieje commented Dec 21, 2019

I am also having the same problem. I tried both use-package to install and then installing it manually via package-list-packages (rm -rf ~/.emacs.d/elpa/org-ql*) before each install. Also have load-prefer-newer to t.

org-ql-block only works if I run org-ql-search beforehand (otherwise, error: "funcall: Symbol’s function definition is void: org-ql-block". I assume I'm a noob and am missing something? Isn't use-package supposed to auto-load to take care of this?

@alphapapa
Copy link
Owner

I have verified, again, that org-ql-block works properly.

  1. Start a clean Emacs config in a sandbox using https://github.com/alphapapa/alpha-org/blob/master/emacs-sandbox.sh.
  2. M-x package-install RET org-ql RET.
  3. Make and save test file:
* [#A] Heading                                                        :Emacs:
blah
  1. Add to agenda files with C-c [.
  2. Evaluate this Elisp:
(let ((org-agenda-custom-commands
       '(("a" ""
	  ((org-ql-block '(and 
                              (tags "Emacs")
                              (priority "A"))
			 ((org-ql-block-header ":Emacs: High-priority"))))))))
  (org-agenda nil "a"))

Output:

:Emacs: High-priority
  [#A] Heading                                                                                  :Emacs:

If it doesn't work properly in your system, you either have a configuration error or the package is not installed correctly.

@jakejx
Copy link

jakejx commented Dec 25, 2019

Something's fishy here. I get this again:

org-ql-block is an alias for ‘org-ql-search-block’, which is not defined.

I get rid of org-ql and peg using your function, restart emacs, packages get fetched and installed, everything's working fine. The I restart emacs and the error re-appears.

Could it be related to the order I load the packages? I committed my recent changes, if you need to take a look: https://github.com/novoid/dot-emacs/blob/master/config.org

Having re-started my emacs for a couple of hundred times today, I'm happily volunteering in debugging this, if this helps.

Here to report that I am facing the same issue. I am running spacemacs on Emacs 27. When I install the package, the autoloads seem to work properly. But once I restart Emacs, and run my agenda, I get Symbol’s function definition is void: org-ql-block.

I'll try to debug and see whats causing the issue.

@alphapapa
Copy link
Owner

alphapapa commented Dec 25, 2019

@jakejx Thanks, I see the problem now. I've reopened #53; please see my comment there. @novoid @rieje also.

@karlicoss
Copy link

Hey, so I reinstalled my OS recently, freshly cloned my emacs setup and the void-function peg-parse-string started happening!
I'm using org-ql 0.4.5 (c847afe).

I investigated a bit and it seems that in the most recent version of peg this function was moved to peg-tests.el. I even tried (require 'peg-test) and retrying org-ql-search, but then ran into this error.

After digging a bit more, it seems that org-ql requires 0.6, whereas in my Doom package has the version 1.0. Not sure if Doom is to blame -- frankly I don't know much about Emacs packaging -- does "0.6" mean minimum version, or exact version? Elpa only has 1.0 (does it keep the history at all?), and the oldest commit in the emacs-straight mirror is 0.7. Not sure where to get 0.6, but I tried using 0.7 and it seems to work!

@alphapapa
Copy link
Owner

@karlicoss Thanks, I think I see the problem now. The macro peg-parse-string was indeed moved to peg-tests.el, and in version 1.0 of peg on ELPA, that's where it is. But in the version I have installed in my config, it's still present in peg.el, so this error does not present itself.

Normally this problem would be detected by my testing in a clean Emacs configuration. However, when I follow these steps in a clean config:

  1. Install helm-org.
  2. Install org-ql.
  3. M-x describe-function RET peg-parse-string RET

The macro peg-parse-string is found as having been loaded from peg-tests.el. I think this is an idiosyncrasy of the package-install process and the fact that peg-tests.el is present in the ELPA package (test files are not usually present in installed Emacs packages). Because of that, this error was masked in my testing.

I wish that function hadn't been moved to the test file, but it should be a simple fix to implement its equivalent in this package, which should fix the problem.

Thanks for following up with those details.

@alphapapa alphapapa reopened this Jul 13, 2020
alphapapa added a commit that referenced this issue Jul 13, 2020
Unfortunately, the macro was moved from peg.el to peg-tests.el in
later versions of peg, so we copy it for our use here.

Fixes #75.  Thanks to Karl Void (@novoid) and @karlicoss for
reporting.

Released as 0.4.6.
@alphapapa
Copy link
Owner

@novoid @karlicoss I think that should fix it. I tested manually in a clean configuration (keeping in mind the issues I mentioned), and it seems to work properly. Please let me know how it works for you.

alphapapa added a commit that referenced this issue Jul 13, 2020
Unfortunately, the macro was moved from peg.el to peg-tests.el in
later versions of peg, so we copy it for our use here.

Fixes #75.  Thanks to Karl Voit (@novoid) and @karlicoss for
reporting.

Released as 0.4.6.
@novoid
Copy link
Author

novoid commented Jul 13, 2020

I currently can not reproduce the issue since my org-ql isn't working at all (see #129).

I can't use my previous workaround with re-installing org-ql because there is no "uninstall" button for org-ql in my list-packages any more because(?) it is installed as a dependency for something.

@karlicoss
Copy link

@alphapapa thanks, pulled your latest change and it worked! 👍

@alphapapa
Copy link
Owner

I currently can not reproduce the issue since my org-ql isn't working at all (see #129).

I can't use my previous workaround with re-installing org-ql because there is no "uninstall" button for org-ql in my list-packages any more because(?) it is installed as a dependency for something.

It's getting confusing discussing this problem in two issues. I suspect your problem may be fixed by the fix to this issue, but let's discuss your problem in #129.

@novoid
Copy link
Author

novoid commented Jul 20, 2020

Purging my packages and re-installing them from scratch, pulling the updates solved the issue on my side.

Thanks for your help!

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

6 participants