From 2e987d60e47da0a7da8ded32bc5c2cc6bf11db04 Mon Sep 17 00:00:00 2001 Message-Id: <2e987d60e47da0a7da8ded32bc5c2cc6bf11db04.1635052126.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sun, 24 Oct 2021 13:06:47 +0800 Subject: [PATCH] org.el: Check for mixed installation * lisp/org.el (org-check-mixed-installation): New macro checking all the loaded org libraries to be from the same directory and to have the same extension (no mixing of .el and .elc). (org-mode): Call `org-check-mixed-installation' before and after `org-mode' loading. --- lisp/org.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 90c645625..0d009ccb5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -90,6 +90,55 @@ (or (eq this-command 'eval-buffer) (message "You need to run \"make\" or \"make autoloads\" from Org lisp directory") (sit-for 3)))) +(defmacro org-check-mixed-installation () + "Detect mixed installation." + `(let* ((org-feature-list '( ob-C ob-R ob-awk ob-clojure ob-comint + ob-core ob-css ob-ditaa ob-dot ob-emacs-lisp + ob-eshell ob-eval ob-exp ob-forth ob-fortran + ob-gnuplot ob-groovy ob-haskell ob-java + ob-js ob-julia ob-latex ob-lilypond + ob-lisp ob-lob ob-lua ob-makefile + ob-matlab ob-maxima ob-ocaml ob-octave + ob-org ob-perl ob-plantuml ob-processing + ob-python ob-ref ob-ruby ob-sass ob-scheme + ob-screen ob-sed ob-shell ob-sql ob-sqlite + ob-table ob-tangle ob oc-basic oc-biblatex + oc-bibtex oc-csl oc-natbib oc ol-bbdb ol-bibtex + ol-docview ol-doi ol-eshell ol-eww ol-gnus + ol-info ol-irc ol-man ol-mhe ol-rmail + ol-w3m ol org-agenda org-archive org-attach-git + org-attach org-capture org-clock org-colview + ;; org-compat + org-crypt org-ctags org-datetree + org-duration org-element org-entities + org-faces org-feed org-footnote org-goto + org-habit org-id org-indent org-inlinetask + org-install org-keys org-lint org-list + org-macro org-macs org-mobile org-mouse + org-num org-pcomplete org-persist org-plot + org-protocol org-refile org-src org-table + org-tempo org-timer org ox-ascii ox-beamer + ox-html ox-icalendar ox-koma-letter ox-latex + ox-man ox-md ox-odt ox-org ox-publish + ox-texinfo ox)) + (loaded-features (seq-filter + (lambda (f) (memq (alist-get 'provide f) + org-feature-list)) + load-history)) + (loaded-files (mapcar #'car loaded-features))) + (unless (and (= 1 (length (cl-remove-duplicates + (mapcar (lambda (path) (file-name-directory path)) + loaded-files) + :test #'equal))) + (= 1 (length (cl-remove-duplicates + (mapcar (lambda (path) (file-name-extension path)) + loaded-files) + :test #'equal)))) + (warn "Mixed Org mode installation detected. +Please make sure that you deleted old Org files after upgrade and do +not load Org/external packages depending on Org before setting the +correct `load-path' in your init.el.")))) + (eval-and-compile (require 'org-macs)) (require 'org-compat) (require 'org-keys) @@ -4840,6 +4889,7 @@ (define-derived-mode org-mode outline-mode "Org" The following commands are available: \\{org-mode-map}" + (org-check-mixed-installation) (org-load-modules-maybe) (org-install-agenda-files-menu) (when org-link-descriptive (add-to-invisibility-spec '(org-link))) @@ -4978,8 +5028,9 @@ (define-derived-mode org-mode outline-mode "Org" (set-face-foreground 'org-hide foreground))) ;; Set face extension as requested. (org--set-faces-extend '(org-block-begin-line org-block-end-line) - org-fontify-whole-block-delimiter-line) - (org--set-faces-extend org-level-faces org-fontify-whole-heading-line)) + org-fontify-whole-block-delimiter-line) + (org--set-faces-extend org-level-faces org-fontify-whole-heading-line) + (org-check-mixed-installation)) ;; Update `customize-package-emacs-version-alist' (add-to-list 'customize-package-emacs-version-alist -- 2.32.0