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

Builtin Org mode (8.x) breaking Spacemacs Org mode (9.x) #8414

Closed
RockyRoad29 opened this issue Feb 20, 2017 · 13 comments
Closed

Builtin Org mode (8.x) breaking Spacemacs Org mode (9.x) #8414

RockyRoad29 opened this issue Feb 20, 2017 · 13 comments
Labels
- Bug tracker - Fixed in develop Loading Org stale marked as a stale issue/pr (usually by a bot)

Comments

@RockyRoad29
Copy link
Contributor

Description :octocat:

Builtin Org mode (8.x) breaking Spacemacs Org mode (9.x)

Some org packages are loaded from org-plus-contrib ,
which currently depends on org version 9.0.x ,
while some other are loaded from the built-in emacs,
which is usually 8.x .

This causes many incompatibilities due e.g. to changes
of variable to functions, like
org-link-types ( change ),
or org-babel-check-confirm-evaluate

Reproduction guide 🪲

  • Install a fresh spacemacs from git master branch (0.200.7)
  • Evaluate lisp expressions, e.g. in ielm or *scratch* in lisp interaction mode.
; These are ok:
(org-version)
"9.0.5"
(locate-library "org")
"/home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org.elc"

; These are not:
(find-lisp-object-file-name #'org-version t)
"/usr/share/emacs/25.1/lisp/org/org.el"
(functionp 'org-link-types)
nil
(find-lisp-object-file-name 'org-link-types 'defvar)
"/usr/share/emacs/25.1/lisp/org/org.el"
(functionp 'org-babel-check-confirm-evaluate)
nil

Yes, it looks like (org-version) is lying !!!

However, the responsability of loading the libs properly comes to Spacemacs
I think.

I think that #'find-lisp-object-file-name is what is used
in #'describe-function but it didn't work as expected for
functions from 'ob. Anyway there is some discrepancy around.

Observed behaviour: 👀 💔

Some actions in org-mode fail and you'd see messages like:

File mode specification error: (void-function org-link-types)


org-element--set-regexps: Symbol’s function definition is void: org-link-types

(see more on #8074') .

Sometimes, I managed to get rid of these org-link-types errors, but then (with some recompilation voodoo) I found that source block evaluation was failing (package ob : org-babel):

Evaluation of this emacs-lisp code block is disabled.

(see more on #7641)

Expected behaviour: ❤️ 😄

I'd expect that all org modules would be loaded from elpa
(or none at worst) to ensure version comptability between libraries.

(find-lisp-object-file-name #'org-version t)
"/home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org.elc"

(functionp 'org-link-types)
t
(find-lisp-object-file-name 'org-link-types 'defvar)
nil
(find-lisp-object-file-name 'org-link-types t)
"/home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org.elc"

(functionp 'org-babel-check-confirm-evaluate)
t

Details about org libraries

I wrote a few helpers to explore the loaded libraries and here are
some results:

* Live Packages Exploration

776 total modules currently loaded, 561 registered features


** 34 modules matching "/org" (4%)
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-clock.elc
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-capture.elc
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-agenda.elc
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-table.elc
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/ob-octave.elc
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-table.el
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/ob-octave.el
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-version.el
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-loaddefs.el
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-plus-contrib-autoloads.el
  - /home/mich/.emacs.d/elpa/org-bullets-20140918.1137/org-bullets-autoloads.el
  - /usr/share/emacs/25.1/lisp/org/org.elc
  - /usr/share/emacs/25.1/lisp/org/org-macro.elc
  - /usr/share/emacs/25.1/lisp/org/org-footnote.elc
  - /usr/share/emacs/25.1/lisp/org/org-pcomplete.elc
  - /usr/share/emacs/25.1/lisp/org/org-list.elc
  - /usr/share/emacs/25.1/lisp/org/org-faces.elc
  - /usr/share/emacs/25.1/lisp/org/org-entities.elc
  - /usr/share/emacs/25.1/lisp/org/org-version.el
  - /usr/share/emacs/25.1/lisp/org/ob-emacs-lisp.elc
  - /usr/share/emacs/25.1/lisp/org/ob.elc
  - /usr/share/emacs/25.1/lisp/org/ob-tangle.elc
  - /usr/share/emacs/25.1/lisp/org/ob-ref.elc
  - /usr/share/emacs/25.1/lisp/org/ob-lob.elc
  - /usr/share/emacs/25.1/lisp/org/ob-table.elc
  - /usr/share/emacs/25.1/lisp/org/ob-exp.elc
  - /usr/share/emacs/25.1/lisp/org/org-src.elc
  - /usr/share/emacs/25.1/lisp/org/ob-keys.elc
  - /usr/share/emacs/25.1/lisp/org/ob-comint.elc
  - /usr/share/emacs/25.1/lisp/org/ob-core.elc
  - /usr/share/emacs/25.1/lisp/org/ob-eval.elc
  - /usr/share/emacs/25.1/lisp/org/org-compat.elc
  - /usr/share/emacs/25.1/lisp/org/org-macs.elc
  - /usr/share/emacs/25.1/lisp/org/org-loaddefs.el

** 13 modules matching "/ob" (1%)
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/ob-octave.elc
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/ob-octave.el
  - /usr/share/emacs/25.1/lisp/org/ob-emacs-lisp.elc
  - /usr/share/emacs/25.1/lisp/org/ob.elc
  - /usr/share/emacs/25.1/lisp/org/ob-tangle.elc
  - /usr/share/emacs/25.1/lisp/org/ob-ref.elc
  - /usr/share/emacs/25.1/lisp/org/ob-lob.elc
  - /usr/share/emacs/25.1/lisp/org/ob-table.elc
  - /usr/share/emacs/25.1/lisp/org/ob-exp.elc
  - /usr/share/emacs/25.1/lisp/org/ob-keys.elc
  - /usr/share/emacs/25.1/lisp/org/ob-comint.elc
  - /usr/share/emacs/25.1/lisp/org/ob-core.elc
  - /usr/share/emacs/25.1/lisp/org/ob-eval.elc

** 18 features matching "org.*" (3%)
  - org-mime: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-mime.elc
  - org-clock: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-clock.elc
  - org-capture: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-capture.elc
  - org-agenda: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-agenda.elc
  - org-table: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-table.elc
  - org: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org.elc
  - org-macro: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-macro.elc
  - org-footnote: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-footnote.elc
  - org-pcomplete: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-pcomplete.elc
  - org-list: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-list.elc
  - org-faces: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-faces.elc
  - org-entities: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-entities.elc
  - org-version: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-version.el
  - org-src: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-src.elc
  - org-compat: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-compat.elc
  - org-macs: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-macs.elc
  - org-loaddefs: /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-loaddefs.el
  - georgian: /usr/share/emacs/25.1/lisp/language/georgian.elc

System Info 💻

  • OS: gnu/linux
  • Emacs: 25.1.1
  • Spacemacs: 0.200.7
  • Spacemacs branch: master (rev. c2774bc)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(helm emacs-lisp)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
@RockyRoad29
Copy link
Contributor Author

RockyRoad29 commented Feb 21, 2017

After some spacemacs restarts, the results seem to improve. Would there be some kind of load-path optimization ?

But even when all org-packages are loaded from elpa, the org-babel evaluation disabled error persists.

Maybe the problem could be that org-plus-contrib, although it contains all and more libs than org,
doesn't always stay above other org-related packages, in load-path. Here's what I have at the moment:

** Load Paths entries matching /o*
  - /home/mich/.emacs.d/elpa/ox-pandoc-20161125.35
  - /home/mich/.emacs.d/elpa/orgit-20170118.1647
  - /home/mich/.emacs.d/elpa/org-projectile-20161205.1508
  - /home/mich/.emacs.d/elpa/org-present-20141109.1756
  - /home/mich/.emacs.d/elpa/org-pomodoro-20161119.226
  - /home/mich/.emacs.d/elpa/org-mime-20170218.501
  - /home/mich/.emacs.d/elpa/org-download-20170213.1151
  - /home/mich/.emacs.d/elpa/org-bullets-20140918.1137
  - /home/mich/.emacs.d/elpa/org-20170210
  - /home/mich/.emacs.d/elpa/open-junk-file-20161210.314
  - /home/mich/.emacs.d/elpa/ob-http-20170218.503
  - /home/mich/.emacs.d/layers/+emacs/org/local/evil-org/
  - /home/mich/.emacs.d/elpa/org-plus-contrib-20170210
  - /usr/share/emacs/25.1/lisp/org
  - /usr/share/emacs/25.1/lisp/obsolete

So org-plus-contrib arrives nearly last ! .

Although it seems that an effort is being made in configuration-layer//package-install-org (I had no time to dive into it), but maybe load-path gets messed afterward ?

Related posts:

@RockyRoad29
Copy link
Contributor Author

RockyRoad29 commented Feb 22, 2017

My gist is really a WIP and I just added interesting results there.

They show that , on a fresh install of develop branch:

  1. recompilation of a fresh install eventually get the load-path right and avoid reference to builtin org package.
  2. activation of org layer breaks it all again. But recompilation fixes it again.
  3. org babel evaluation of elisp works only on top of org 8.x .

@RockyRoad29
Copy link
Contributor Author

\o/ SUCCESS with org-babel evaluation !!

after specific recompilation of org-plus-contrib/ob-core.el .
Batch recompilation skips too many files...

@CestDiego
Copy link
Contributor

Thank you for your work on this :)

@syl20bnr
Copy link
Owner

@RockyRoad29 Your issue seems to be fixed, if so you can close this issue :-)

@absolutejam
Copy link

Is this supposed to be sorted now?

Had a couple of new spacemacs installs over the last month or so and still getting the built-in org mode loading (And thus, stuff breaking 😢)

@absolutejam
Copy link

My bad. After searching my .spacemacs over and over, I still missed a segment of org-related config that was loading too early!

@RockyRoad29
Copy link
Contributor Author

@syl20bnr Actually I had kind of fixed it for myself working on the dev branch, which let me forget about this issue. Today I attempted an upgrade from the spacemacs home buffer (forgot about the dev branch), and all org-mode went in a mess again. I tried again from a clean install of the master branch (- Emacs: 25.3.1 - Spacemacs: 0.200.10) but the problem is still there. Batch compilation doesn't really help. I feel there should be something to do about compilation order. But I don't have much time to put in that now.

@ibizaman
Copy link

I didn't find this information easily, so I'm posting it here since it's the second time I need to find it.

To fix this, because I'm using multiple branches (mostly because I didn't clean up after switching to the develop/ branch), I needed to, from the root of the spacemacs git repo:

find **/org* -name "*.elc" -delete

Then from emacs:

spacemacs/recompile-elpa

@syl20bnr
Copy link
Owner

Should be fixed in develop, please verify.

@RockyRoad29
Copy link
Contributor Author

RockyRoad29 commented Jan 22, 2018

Thank you @syl20bnr . I upgraded last night to commit 723604d . As I figured out last weeks, org babel errors can often be solved by calling e.g. (require 'ob-shell) for each language as needed. I had to do it again after the upgrade, which I performed outside of spacemacs with a git fetch and git pull. I didn't have to recompile elpa.

I enjoyed then the SPC f e D feature to update my dotfile.

@RockyRoad29
Copy link
Contributor Author

Since, I got annoyed with org-table bug
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg116990.html
so I decided to update all packages... and problems arise everywhere again,
first with complaints about org-link-types, then with org-babel disabled.

I can see in many places this advice of removing *.elc* files to force
recompilation, but it tends to worsen things for me, while day to day usage
tend to smooth them... until next upgrade/update.

What does help:spacemacs/recompile-elpa actually do ?

  (byte-recompile-directory package-user-dir nil t)

Would there be a misunderstanding of help:byte-recompile-directory ?

(byte-recompile-directory DIRECTORY &optional ARG FORCE)

Is called with ARG=nil, which means that
.el files with missing .elc files will not be compiled.
FORCE is t, which means we'll
keep on compiling what is alread up-to-date .

I think it is ARG=0 and FORCE=nil we need.

Knowing that many problems arise from site emacs packages shadowing spacemacs
newer versions, I propose this little script which seems to solve many
org-mode issues for me.

  (let (
        (org-base-dir (file-name-directory (find-library-name "org")))
        )
    (if
         (string-match (concat (file-name-as-directory package-user-dir) "org-plus-contrib") (find-library-name "org"))
        (byte-recompile-directory org-base-dir 0 nil)
      (message "unexpected location for org package : %s" org-base-dir)
      )
    )

Deleting all .elc files seems to me as increasing the risk of getting packages
compiled with older site versions. The documentation about "Loading"
(info:elisp#Loading) is a bit tough too, but it may be worth reading carefully
to know about the priorities (by suffix / by date / by path) and dependency
management. I did not yet.

Hoping this can help.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Bug tracker - Fixed in develop Loading Org stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

6 participants