emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Requiring `ol` in `org-real`s autoloads


From: Stefan Monnier
Subject: Requiring `ol` in `org-real`s autoloads
Date: Thu, 19 Oct 2023 16:57:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

In `org-real.el` I see:

    ;;;###autoload
    (require 'ol)

This is bad for several reasons, such as the fact that it slows down
startup by forcing the load of part of Org, but more importantly it
breaks Org:

The order in which packages are activated is not deterministic,
so it's totally possible that `org-real` gets loaded before
`org` gets activated (I know, because that's how I bumped into this
problem), meaning that the above (require 'ol) will load the `ol` (and
`org-compat` etc...) that's bundled with Emacs, while later on the
non-bundled Org package will be activated at which point it will burp
because you can't have two different versions of Org loaded at the same
time (e.g. currently the `org-compat` in Emacs doesn't define
`org--flatten-tree`, so loading `org-src` from the unbundled Org
package will break if you've loaded the `org-compat` that's bundled in
your Emacs).

The patch below seems to fix the problem.


        Stefan
diff --git a/org-real.el b/org-real.el
index 35604ed7f1..9c45d0e0d8 100644
--- a/org-real.el
+++ b/org-real.el
@@ -1,6 +1,6 @@
 ;;; org-real.el --- Keep track of real things as org-mode links -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021-2023 Free Software Foundation, Inc.
 
 ;; Author: Taylor Grinn <grinntaylor@gmail.com>
 ;; Version: 1.0.6
@@ -49,7 +49,6 @@
 
 ;;;; Requirements
 
-;;;###autoload
 (require 'ol)
 
 (require 'boxy)
@@ -333,9 +332,10 @@ diagram."
 ;;;; `org-insert-link' configuration
 
 ;;;###autoload
-(org-link-set-parameters "real"
-                         :follow #'org-real-follow
-                         :complete #'org-real-complete)
+(with-eval-after-load 'ol
+  (org-link-set-parameters "real"
+                           :follow #'org-real-follow
+                           :complete #'org-real-complete))
 
 ;;;###autoload
 (defun org-real-follow (url &rest _)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]