After Spacemacs upgrade to 0.200.7, org-mode 9. falls back to built-in 8.x and causes multiple issues.
The first issue I detected was xhen pressing M-RETURN to insert a new heading, nothing happens but a message:
org-element–set-regexps: Symbol’s function definition is void: org-link-types
According to https://emacs.stackexchange.com/questions/29471/error-message-symbols-function-definition-is-void-org-link-types-when-i-open?rq=1 it may be a version conflict between built-in org-mode in emacs and shadowing org-mode from local spacemacs.
Here are my versions:
ELISP> (org-version) "9.0.5" ELISP> (emacs-version) "GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.5)\n of 2016-12-23" ELISP> (spacemacs/display-and-copy-version) "Spacemacs v.0.200.7" ELISP>
From my /usr/share/emacs/25.1/lisp/org/org-version.el I found that emacs built-in org-release is “8.2.10”
For investigation purposes, I renamed my ~/.emacs.d/
and ~/.spacemacs/
to work on a fresh environment.
Based on the error message, I intrumented the faulty function:
(debug-on-entry #'org-element--set-regexps)
Debugger entered--entering a function: * org-link-types() * #[0 "\306�\307\310\307\311\307\312\313\307\314\307\315\307\316\317\307\320\307\321\307\322\307\323\307\324 !\307\n\325=\203' Debugger entered--entering a function: * org-link-types() * #[0 "\306�\307\310\307\311\307\312\313\307\314\307\315\307\316\317\307\320\307\321\307\322\307\323\307\324 !\307\n\325=\203' * apply(#[0 "\306�\307\310\307\311\307\312\313\307\314\307\315\307\316\317\307\320\307\321\307\322\307\323\307\324 !\307\n\325=\203' * org-element--set-regexps() org-element-at-point() org-meta-return() funcall-interactively(org-meta-return) call-interactively(org-meta-return nil nil) command-execute(org-meta-return)
Debugger entered--entering a function: * org-element--set-regexps() require(org-element) org-setup-filling() org-mode() set-auto-mode-0(org-mode nil) set-auto-mode() normal-mode(t) after-find-file(nil t) find-file-noselect-1(#<buffer bug-org-link-types.org> "~/.emacs.d1/private/reinstall-170217/gist-55936d/bug-org-link-types.org" nil nil "~/.emacs.d1/private/reinstall-170217/gist-55936d/bug-org-link-types.org" (25222609 2058)) find-file-noselect("/home/mich/.emacs.d1/private/reinstall-170217/gist-55936d/bug-org-link-types.org" nil nil nil) find-file("/home/mich/.emacs.d1/private/reinstall-170217/gist-55936d/bug-org-link-types.org") find-file-at-point("/home/mich/.emacs.d1/private/reinstall-170217/gist-55936d/bug-org-link-types.org") helm-find-file-or-marked("/home/mich/.emacs.d1/private/reinstall-170217/gist-55936d/bug-org-link-types.org") helm-execute-selection-action-1() helm-execute-selection-action() helm-internal(helm-source-find-files "/tmp/" "Find files or url: " nil nil "*helm find files*" nil nil nil) apply(helm-internal (helm-source-find-files "/tmp/" "Find files or url: " nil nil "*helm find files*" nil nil nil)) helm(helm-source-find-files "/tmp/" "Find files or url: " nil nil "*helm find files*" nil nil nil) apply(helm (helm-source-find-files "/tmp/" "Find files or url: " nil nil "*helm find files*" nil nil nil)) helm(:sources helm-source-find-files :input "/tmp/" :case-fold-search smart :preselect nil :ff-transformer-show-only-basename t :default nil :prompt "Find files or url: " :buffer "*helm find files*") helm-find-files-1("/tmp/") (let* ((hist (and arg helm-ff-history (helm-find-files-history))) (default-input hist) (input (cond ((and (eq major-mode (quote dired-mode)) default-input) (file-name-directory default-input)) ((and (not (string= default-input "")) default-input)) (t (expand-file-name (helm-current-directory)))))) (set-text-properties 0 (length input) nil input) (helm-find-files-1 input)) spacemacs/helm-find-files(nil) funcall-interactively(spacemacs/helm-find-files nil) call-interactively(spacemacs/helm-find-files nil nil) command-execute(spacemacs/helm-find-files)
I was not too sure of spacemacs specificities, so I went back to the main doc: http://spacemacs.org/doc/DOCUMENTATION.html#troubleshoot and accordingly I ran:
M-x spacemacs/recompile-elpa
Following that I was able to load this gist file, but soon the debugger triggered again.
Debugger entered--entering a function: * org-element--set-regexps() require(org-element) org-setup-filling() org-mode() set-auto-mode-0(org-mode nil) set-auto-mode() normal-mode() funcall-interactively(normal-mode) call-interactively(normal-mode record nil) command-execute(normal-mode record) helm-M-x(nil #("normal-mode" 0 11 (match-part "normal-mode"))) funcall-interactively(helm-M-x nil #("normal-mode" 0 11 (match-part "normal-mode"))) call-interactively(helm-M-x nil nil) command-execute(helm-M-x)
Oops, I had forgotten to disable the debugger. Ok,
(cancel-debug-on-entry #'org-element--set-regexps)
then
(normal-mode)
… go through to similar message:
File mode specification error: (void-function org-link-types)
So recompilation did not fix it.
I imagine plenty other actions would trigger the same error.
It seems that at some point, the new org-mode 9.0 falls into system’s version 8.x and raises the compatibility issue.
So I’d better go back to previous spacemacs release.
lujianmei blames https://github.com/zilongshanren/spacemacs-private/blob/develop/layers/zilongshanren-org/packages.el but I’m using the official repo and the “faulty statement” is there: https://github.com/syl20bnr/spacemacs/blob/master/layers/%2Bemacs/org/packages.el#L24
#### System Info :computer: - OS: gnu/linux - Emacs: 25.1.1 - Spacemacs: 0.200.7 - Spacemacs branch: master (rev. c2774bc0d) - Graphic display: t - Distribution: spacemacs - Editing style: vim - Completion: helm - Layers: ```elisp (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
and more layers enabled:
#### System Info :computer: - OS: gnu/linux - Emacs: 25.1.1 - Spacemacs: 0.200.7 - Spacemacs branch: master (rev. c2774bc0d) - Graphic display: t - Distribution: spacemacs - Editing style: vim - Completion: helm - Layers: ```elisp (helm auto-completion emacs-lisp git html javascript latex markdown org php plantuml python shell-scripts (spell-checking :variables spell-checking-enabled-by-default nil) sql version-control) ``` - 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
No further customization though, so the autoloading warning http://spacemacs.org/layers/+emacs/org/README.html#important-note does not apply yet.
Because of autoloading, calling to org functions will trigger the loading up of the org shipped with emacs which will induce conflicts. One way to avoid conflict is to wrap your org config code in a `with-eval-after-load block` …
So, according to Lujianmei, the culprit would be ‘:location built-in’ setting in org layer’s package.el .
http://spacemacs.org/doc/LAYERS.html#packagesel
syl20bnr wrote on 2016-03-23:
;; ob, org and org-agenda are installed by `org-plus-contrib'
but the lines underneath are older:
13fe9f3cc9 ( syl20bnr 2016-03-23 10:17:46 -0400 22) ;; ob, org and org-agenda are installed by `org-plus-contrib' 13fe9f3cc9 ( syl20bnr 2016-03-23 10:17:46 -0400 23) (ob :location built-in) 3f1f1a9fbc ( syl20bnr 2015-09-23 22:03:38 -0400 24) (org :location built-in) 1ca1ee3720 (Eivind Fonn 2015-11-17 19:52:20 +0100 25) (org-agenda :location built-in) edc4493e19 ( syl20bnr 2016-04-21 23:26:57 -0400 26) org-download c0a66452a7 ( syl20bnr 2015-09-23 22:04:07 -0400 27) ;; org-mime is installed by `org-plus-contrib' c0a66452a7 ( syl20bnr 2015-09-23 22:04:07 -0400 28) (org-mime :location built-in) 6844ff9fed ( syl20bnr 2015-04-11 00:13:02 -0400 29) org-pomodoro 7e18daf5f5 ( syl20bnr 2015-05-14 00:17:12 -0400 30) org-present 31f37fc4d7 (Eivind Fonn 2016-06-14 11:35:54 +0200 31) (org-projectile :toggle (configuration-layer/package-usedp 'proj b0808732cf (Christian Gram Kalhauge 2016-09-23 18:06:57 -0700 32) (ox-twbs :toggle org-enable-bootstrap-support)
But what does this comment mean, actually ?
Maybe a hint:
~/.emacs.d/layers/+spacemacs/spacemacs-org/packages.el 24: (org-plus-contrib :step pre) 33:;; dummy init function to force installation of `org-plus-contrib' 34:(defun spacemacs-org/init-org-plus-contrib ())
- file:~/.emacs.d/layers/+spacemacs/spacemacs-org/packages.el::24
So the org-plus-contrib package
- being loaded from spacemacs itself
- containing the required packages
- –> don’t need to be included in org-layer package list.
Let’s try:
- file:~/.emacs.d/layers/+emacs/org/packages.el::24
diff --git a/layers/+emacs/org/packages.el b/layers/+emacs/org/packages.el index 4963f4a43..1ed3af9f6 100644 --- a/layers/+emacs/org/packages.el +++ b/layers/+emacs/org/packages.el @@ -20,12 +20,13 @@ htmlize mu4e ;; ob, org and org-agenda are installed by `org-plus-contrib' - (ob :location built-in) - (org :location built-in) - (org-agenda :location built-in) + ;; which is loaded from core layers/+spacemacs/spacemacs-org/packages.el + ;; (ob :location built-in) + ;; (org :location built-in) + ;; (org-agenda :location built-in) org-download ;; org-mime is installed by `org-plus-contrib' - (org-mime :location built-in) + ;; (org-mime :location built-in) org-pomodoro org-present (org-projectile :toggle (configuration-layer/package-usedp 'projectile))
test (after spacemacs restart):
ELISP> (functionp #'org-link-types) t
… and M-RET works \o/ sounds good so far ! But more testing is needed.
ELISP> (require 'ob) ob ELISP> (require 'org) org ELISP> (require 'org-agenda) org-agenda ELISP> (setq l1 (seq-filter (lambda (x) (string-match "/org" x)) (mapcar #'car load-history)) rslt t) t ELISP> (length l1) 50 (#o62, #x32, ?2) ELISP> (prog1 t (dolist (x l1) (princ x) (princ "\n"))) /home/mich/.emacs.d/elpa/org-20170210/org-agenda.elc /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-eldoc.elc /home/mich/.emacs.d/layers/+emacs/org/local/evil-org/evil-org.el /home/mich/.emacs.d/elpa/org-bullets-20140918.1137/org-bullets.elc /home/mich/.emacs.d/elpa/org-download-20170213.1151/org-download.elc /home/mich/.emacs.d/elpa/org-20170210/org-rmail.elc /home/mich/.emacs.d/elpa/org-20170210/org-mhe.elc /home/mich/.emacs.d/elpa/org-20170210/org-irc.elc /home/mich/.emacs.d/elpa/org-20170210/org-info.elc /home/mich/.emacs.d/elpa/org-20170210/org-gnus.elc /home/mich/.emacs.d/elpa/org-20170210/org-docview.elc /home/mich/.emacs.d/elpa/org-20170210/org-bibtex.elc /home/mich/.emacs.d/elpa/org-20170210/org-bbdb.elc /home/mich/.emacs.d/elpa/org-20170210/org-w3m.elc /home/mich/.emacs.d/elpa/orgit-20170118.1647/orgit.elc /home/mich/.emacs.d/elpa/org-20170210/org-element.elc /home/mich/.emacs.d/elpa/org-20170210/org.elc /home/mich/.emacs.d/elpa/org-20170210/org-macro.elc /home/mich/.emacs.d/elpa/org-20170210/org-footnote.elc /home/mich/.emacs.d/elpa/org-20170210/org-pcomplete.elc /home/mich/.emacs.d/elpa/org-20170210/org-list.elc /home/mich/.emacs.d/elpa/org-20170210/org-faces.elc /home/mich/.emacs.d/elpa/org-20170210/org-entities.elc /home/mich/.emacs.d/elpa/org-20170210/org-version.el /home/mich/.emacs.d/elpa/org-20170210/ob-emacs-lisp.elc /home/mich/.emacs.d/elpa/org-20170210/ob.elc /home/mich/.emacs.d/elpa/org-20170210/ob-tangle.elc /home/mich/.emacs.d/elpa/org-20170210/org-src.elc /home/mich/.emacs.d/elpa/org-20170210/ob-ref.elc /home/mich/.emacs.d/elpa/org-20170210/ob-lob.elc /home/mich/.emacs.d/elpa/org-20170210/ob-table.elc /home/mich/.emacs.d/elpa/org-20170210/ob-keys.elc /home/mich/.emacs.d/elpa/org-20170210/ob-exp.elc /home/mich/.emacs.d/elpa/org-20170210/ob-comint.elc /home/mich/.emacs.d/elpa/org-20170210/ob-core.elc /home/mich/.emacs.d/elpa/org-20170210/ob-eval.elc /home/mich/.emacs.d/elpa/org-20170210/org-compat.elc /home/mich/.emacs.d/elpa/org-20170210/org-macs.elc /home/mich/.emacs.d/elpa/org-20170210/org-loaddefs.el /home/mich/.emacs.d/elpa/orgit-20170118.1647/orgit-autoloads.el /home/mich/.emacs.d/elpa/org-projectile-20161205.1508/org-projectile-autoloads.el /home/mich/.emacs.d/elpa/org-present-20141109.1756/org-present-autoloads.el /home/mich/.emacs.d/elpa/org-20170210/org-autoloads.el /home/mich/.emacs.d/elpa/org-pomodoro-20161119.226/org-pomodoro-autoloads.el /home/mich/.emacs.d/elpa/org-download-20170213.1151/org-download-autoloads.el /home/mich/.emacs.d/elpa/org-bullets-20140918.1137/org-bullets-autoloads.el /home/mich/.emacs.d/elpa/org-plus-contrib-20170210/org-plus-contrib-futoloads.el /home/mich/.emacs.d/layers/+emacs/org/config.el /home/mich/.emacs.d/layers/+emacs/org/funcs.el /home/mich/.emacs.d/layers/+emacs/org/packages.el t ELISP>
- https://emacs.stackexchange.com/questions/8182/how-to-use-org-plus-contrib
- https://emacs.stackexchange.com/questions/18972/org-vs-org-plus-contrib-in-emacs24-4
- syl20bnr/spacemacs#3933
- syl20bnr/spacemacs#3742
(require 'ob)
(require 'org)
(require 'org-agenda)
I’d like to be able to execute the lisp code with org-babel, but now all I get is the message:
Evaluation of this emacs-lisp code block is disabled.
I located the source code emitting this message, but was not able to identify the actual cause of this annoying behavior.