From: Ihor Radchenko <yantar92@gmail.com>
To: Tim Cross <theophilusx@gmail.com>
Cc: Greg Minshall <minshall@umich.edu>, emacs-orgmode@gnu.org
Subject: [PATCH] Re: Fwd: errors when using org-agenda
Date: Sun, 24 Oct 2021 13:12:47 +0800 [thread overview]
Message-ID: <87lf2jdn00.fsf@localhost> (raw)
In-Reply-To: <m2a6j0ot8s.fsf@blind-drunk.fritz.box>
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
Tim Cross <theophilusx@gmail.com> writes:
> What would really be needed is some way to check when org is going to be
> compiled that no existing org functionality is loaded. Doubt this can be
> easily done within org itself because of a chicken and egg problem - you
> would have to load org to run the code to check if org is loaded.
I attached a tentative patch checking if org is loaded. It is not
ideal, but it can capture some scenarios.
The patch will not work if older org.el is loaded before newer version
of Org. Though we may put extra checks in other lisp files.
WDYT?
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Check-for-mixed-installation.patch --]
[-- Type: text/x-diff, Size: 4863 bytes --]
From 2e987d60e47da0a7da8ded32bc5c2cc6bf11db04 Mon Sep 17 00:00:00 2001
Message-Id: <2e987d60e47da0a7da8ded32bc5c2cc6bf11db04.1635052126.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
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
next prev parent reply other threads:[~2021-10-24 5:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 20:35 errors when using org-agenda William McCoy
2021-10-23 0:46 ` Fwd: " William McCoy
2021-10-23 1:57 ` Tim Cross
2021-10-23 10:26 ` Greg Minshall
2021-10-23 11:34 ` Tim Cross
2021-10-23 18:07 ` Greg Minshall
2021-10-23 18:21 ` Tim Cross
2021-10-24 0:45 ` Thomas S. Dye
2021-10-24 5:05 ` Greg Minshall
2021-10-24 6:44 ` Tim Cross
2021-10-24 10:55 ` Greg Minshall
2021-10-24 5:12 ` Ihor Radchenko [this message]
2021-10-24 6:59 ` [PATCH] " Tim Cross
2021-10-24 8:16 ` Max Nikulin
2021-10-24 8:34 ` Ihor Radchenko
2021-10-27 16:46 ` Max Nikulin
2022-09-11 9:22 ` Ihor Radchenko
2021-10-23 14:49 ` William McCoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lf2jdn00.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=minshall@umich.edu \
--cc=theophilusx@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.