radian-software / straight.el

šŸ€ Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.74k stars 151 forks source link

Emacs searches function "org", that doesn't exist #830

Closed florhizome closed 3 years ago

florhizome commented 3 years ago

When opening an org file after startup, i get File mode specification error: (error Autoloading file /home/flo/.emacs.d/straight/build/org/org.elc failed to define function org) After inspecting this bit, I can see that this "function" is called by "org-mode-hook" : https://bpa.st/U7FA

And if I try "find-function org", I get directed to the defgroup of org in org.el.

(defgroup org nil ...

I tried changing to the :builtin keyword in the use-packaging declaration, which led to the same error, but pointing to the equivalent file where emacs is installed (/gnu/store/... I'm using guix). The error persists at least since I rebuild all packages after reinstalling Emacs ( An emacs package from a guix channel with pgtk enabled. The version shows 28.0.5.0) - freshly after reinstallation the error did not exist. I'm not entirely sure this is straight's fault, but I also don't know which other package could be involved..

progfolio commented 3 years ago

I'm not entirely sure this is straight's fault

I'm not either.

If I understand correctly the symbol org was added to org-mode-hook. We don't touch any mode hooks. This doesn't rule out some sort of problem with the autoload generation, but I'm not sure how that org would make it's way into org-mode-hook.

In order to diagnose this I would need a reproduction case (preferably using straight-bug-report) and more information about the system environment. straight-bug-report can provide some of that (Emacs version, straight version, etc). It would also be useful to know whether or not you are using a framework like Doom. Sharing your config if it is publicly available is appreciated as well.

florhizome commented 3 years ago

Platform: x86_68 Linux Kernel: 5.10.53-1 MANJARO (Distribution should be clear)

This is GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) straight-version gives prerelease (HEAD -> master) 05aa5e9 2021-07-02

Will try out straight-bug-report.

florhizome commented 3 years ago

The Emacs Package would be the emacsā€“pgtkā€“nativeā€“comp from the flatwhatson guix channel:

https://github.com/flatwhatson/guix-channel

Would you need the whole config? I am trying to write it literally, but itā€˜s not very elaborate yet and I havenā€™t dealt with uploading it yet. I would also want to leave some details in my orgā€“caldav config out^^

florhizome commented 3 years ago

How am I supposed to use straightā€“bugā€“report?

I tried just evaluating this in a scratch buffer:

  ;; -*-lexical-binding t-*-

  (straight-bug-report
   :interactive t
   :post-bootstrap
   (straight-use-package 'org)
   ;(org-mode-hook) ;to toggle 
   )

It will complain about needing lexical binding.

`Lexical binding required for straight-bug-report

` which is why i added the line in the header, but the error still occurs. maybe all of this would have to do with lexical binding..? It might be I didn't declare it on top of my .emacs file which exists just to load the rest of the configfiles. also using load-file and not load, which presumably uses lexical-binding by default. I also experienced a similar bug when writing a variable in a (setq expression) wrong in my config - it got loaded into emacs, so I was abling to search it via find-variable. (note that i did not use defvar).

progfolio commented 3 years ago

How am I supposed to use straight-bug-report?

Lexical binding is enabled by default in Emacs 28's *scratch* buffer. Adding the line should not be necessary unless you've changed that default.

Your bug-report form looks OK to me, so I'm not sure why that wouldn't work. Try evaluating the following test case in the *scratch* buffer without the added lexical-biding line:

Test Case ```emacs-lisp (straight-bug-report :post-bootstrap (straight-use-package 'org) (require 'org) (org-version nil 'full 'message)) ```
Output ```emacs-lisp Bootstrapping straight.el... Bootstrapping straight.el...done Rebuilding all packages due to build cache schema change Looking for gnu-elpa-mirror recipe -> Cloning melpa... Looking for gnu-elpa-mirror recipe -> Cloning melpa...done Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror... Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe -> Cloning el-get... Looking for emacsmirror-mirror recipe -> Cloning el-get...done Looking for straight recipe -> Cloning emacsmirror-mirror... Looking for straight recipe -> Cloning emacsmirror-mirror...done Building straight... Building straight...done Test run with version: prerelease (HEAD -> develop, origin/develop) 08b0ecf 2021-07-24 Cloning org... Cloning org...done Building org... Building org...done Org mode version 9.4.6 (9.4.6-g8df3e2 @ /tmp/straight.el-test-vfafzc/straight/build/org/) Packages: "org-elpa" n/a n/a "melpa" n/a master 2742abfd 2021-08-03 "gnu-elpa-mirror" n/a master 60ade15 2021-08-03 "el-get" melpa master 463f5e98 2021-07-06 "emacsmirror-mirror" n/a master 89b9645 2021-08-03 "straight" n/a develop 08b0ecf 2021-07-24 "org" org-elpa master 8df3e25db 2021-08-01 ```
progfolio commented 3 years ago

If that doesn't work, please try switching to the development branch of straight.el and trying the same test. You can switch by adding:

(setq straight-repository-branch "develop")

prior to straight's bootstrapping code in your init.el. M-x straight-normalize-package straight and M-x straight-rebuild-package straight. Then, after restarting Emacs, you should have the latest version of striaght installed.

florhizome commented 3 years ago

Ok. Like I said the strange thing was I was getting that errror even though I set lexical binding both via the prepended line and the command that exists to set lexical binding for a buffer. somewhere something is just messed up. emacs -q works, gonna bootstrap straight with it and load orgmode in addition to straight-bug-report. Plus Iā€™m just gonna upload the config today, too -.-

florhizome commented 3 years ago

When doing "straight-normalize-all" i'm getting

"In repository straight.el, failed to get status: fatal: Needed a single revision "

then shortcuts to dired and magit and cancel

florhizome commented 3 years ago

ok i got this to run from "scratch"

(setq lexical-binding t)

(straight-bug-report

  :post-bootstrap 
  (straight-use-package 'org)
  (require 'org)
  (org-version nil 'full 'message))

and received

Testing straight.el in directory: /tmp/straight.el-test-VOIlyR error in process sentinel: Symbolā€™s value as variable is void: interactive

I count this as an advancement^^

And in straight-bug-report-process-buffer I get this:

Bootstrapping straight.el...

Bootstrapping straight.el...done

Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe ā†’ Cloning melpa...
Looking for gnu-elpa-mirror recipe ā†’ Cloning melpa...done
Looking for emacsmirror-mirror recipe ā†’ Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe ā†’ Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe ā†’ Cloning el-get...
Looking for emacsmirror-mirror recipe ā†’ Cloning el-get...done
Looking for straight recipe ā†’ Cloning emacsmirror-mirror...
Looking for straight recipe ā†’ Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 08b0ecf 2021-07-24Cloning org...done

Building org...
Building org...done

Org mode version 9.4.6 (9.4.6-g8df3e2 @ /tmp/straight.el-test-VOIlyR/straight/build/org/)
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master 2742abfd 2021-08-03
"gnu-elpa-mirror"         n/a                  master 60ade15 2021-08-03
"el-get"                  melpa                master 463f5e98 2021-07-06
"emacsmirror-mirror"      n/a                  master 324510f 2021-08-04
"straight"                n/a                  develop 08b0ecf 2021-07-24
"org"                     org-elpa             master 8df3e25db 2021-08-01
florhizome commented 3 years ago

Ok this actually was a dumb error on behalve of mine. Thanks for your help! i had the expression :hook (org-mode . (visual-line-mode variable-pitch-mode)) in the use package declaration for orgmode, which caused the error.