emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Masterson <dsmasterson@gmail.com>
To: Tim Cross <theophilusx@gmail.com>
Cc: emacs-orgmode@gnu.org, 59882@gnu.org
Subject: Re: Multiple versions of Org in load-path problem
Date: Thu, 08 Dec 2022 21:00:44 -0800	[thread overview]
Message-ID: <SJ0PR03MB545501C7FB4FA622327017F6A21C9@SJ0PR03MB5455.namprd03.prod.outlook.com> (raw)
In-Reply-To: <86lenhxxs9.fsf@gmail.com> (Tim Cross's message of "Fri, 09 Dec 2022 09:56:23 +1100")

Tim Cross <theophilusx@gmail.com> writes:

> David Masterson <dsmasterson@gmail.com> writes:
>
>> "Michel Schinz" <michel@schi.nz> writes:
>>
>>> Just for the record, I also ran into problems when installing Org 9.6
>>> using Emacs' package system on top of an older version that came with
>>> Emacs. If I tried to install it as usual (M-x list-packages, then
>>> install the package from there), I had errors during compilation related
>>> to `org-assert-version`, and then if I restarted Emacs, I would get a
>>> fatal error in an unrelated package.
>>>
>>> I managed to solve that problem by:
>>> 1. uninstalling Org 9.6 and exiting Emacs,
>>> 2. starting Emacs with -q,
>>> 3. installing Org 9.6 from there (using M-x list-packages as usual),
>>> 4. restarting Emacs.
>>
>> Interesting!  I tried this (essentially) and it worked for my case.  In
>> my case, I had a built-in Org-9.3 and I was trying to use list-packages
>> to install Org-9.6. I checked that using -q still added Org-9.3 to
>> the
>> load-path, but, since Org wasn't loaded, the install via list-packages
>> worked.
>>
>> The question is what's the proper way of doing this without '-q'?

[...]

> I don't think there is any safe way to install an updated version of
> org-mode other than
>
> 1. Use the -q approach outlined above

Thinking about it, this only works if Org is in elpa as melpa (etc.) are
not added to package-archives.  You'd have to do some handwritten elisp
out of *scratch* to setup package-archives if Org-9.6 was still coming
out of melpa. That's why this can only be labeled as a hack and not a
solution.

> 2. Craft your init.el file such that org functionality is only loaded
> when explicitly requested and always update as the first action after
> starting emacs.

In this case, something happened in package-install when trying to
install Org-9.6 with a built-in Org-9.3.  During the compilation check
(.el -> .elc) many files failed because the new 'org-assert-version'
macro was not defined.  Sort of like, after package-install started
working on Org-9.6, org-macs.el (where org-assert-version should be) got
loaded *before* the new load-path had been set causing it to load the
old one from 9.3.  Thereafter, everything went awry. 

> The first approach is actually the easiest. The second is hard to get
> right and very fragile because packages like use-package and more
> specifically, other packages with leverage off org functionality, make it
> impossible to reliably know exactly when org is loaded.

Using ':after" in use-package is supposed to help that, but I'm not sure
it is reliable.  Packages are often incomplete about what other packages
it depends on.

> An approach used by many 'canned' distributions is to postpone package
> updates. You have a function you run to check for updates which
> generates a list of packages to update and writes that list to a
> file. Each time emacs is started, it looks for this update list and if
> it finds it, it installs packages updates at the very beginning of the
> init process (before any of your other init.el code or custom
> blocks). The process also looks for org in the list of packages to
> update and if it is found, updates it first. 

Probably doesn't work in this case as you would need to be able to use
package.el suggesting that the load-path has been updated for all
built-ins already.  The thing I note is that the load-path has already
been updated for built-ins at the beginning of
'~/.emacs.d/early-init.el', but the libraries haven't been loaded yet
(unless needed). That's okay if the newer version of a package then
cleanly replaces all the files in the old version.

> I don't think there is a safe way to load org mode after the init
> process i.e. after booting emacs by M-x package-update.

Where is package-update called in the boot process of emacs?  I don't
see package-update in Emacs v2.7.

> I've had good success using straight.el. I had to be careful regarding
> how I structured my init.el file (ensuring any straight stuff happens
> first and the first use package stanza is for org. The main reason
> straight works well for me is that my work flow is to do a M-x
> straight-pull-all when I want to update my packages. This does a git
> pull for all the sources, but does not do any build/install. This occurs
> when I next start Emacs and because I have all the straight stuff at the
> start and because org mode is the first straight-use-package, the update
> and install happens before any other org functionality is loaded,
> avoiding mixed version issues.

Where do you get straight.el?  I don't see it in [m]elpa.

-- 
David Masterson


  reply	other threads:[~2022-12-09  5:01 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  2:50 Multiple versions of Org in load-path problem David Masterson
2022-12-06  5:36 ` tomas
2022-12-06  7:04   ` David Masterson
2022-12-07 13:30 ` Ihor Radchenko
2022-12-08  3:27   ` David Masterson
2022-12-08  7:16     ` David Masterson
2022-12-08  7:26       ` Ihor Radchenko
2022-12-08 18:24         ` David Masterson
2022-12-08 19:31           ` Michel Schinz
2022-12-08 21:56             ` David Masterson
2022-12-08 22:56               ` Tim Cross
2022-12-09  5:00                 ` David Masterson [this message]
2022-12-09  6:56                   ` Tim Cross
2022-12-09 15:49                     ` Sharon Kimble
2022-12-10 20:38                 ` Tom Gillespie
2022-12-09  7:17               ` bug#59882: " Eli Zaretskii
2022-12-09  7:43                 ` David Masterson
2022-12-09 11:57                   ` Eli Zaretskii
2022-12-09 19:40                   ` Cook, Malcolm
2022-12-09 19:51                     ` David Masterson
2022-12-09 20:27                       ` Eli Zaretskii
2022-12-10 14:01                 ` Ihor Radchenko
2022-12-14  9:51                 ` Ihor Radchenko
2022-12-14 12:59                   ` Eli Zaretskii
2022-12-14 13:37                     ` Ihor Radchenko
2022-12-14 14:35                       ` Stefan Monnier
2022-12-14 16:02                         ` Max Nikulin
2022-12-15  4:17                           ` Stefan Monnier
2022-12-15  4:56                             ` Ihor Radchenko
2022-12-16 12:36                             ` Max Nikulin
2022-12-16 14:47                               ` Ihor Radchenko
2022-12-18 15:24                                 ` Max Nikulin
2022-12-18 15:40                                   ` Stefan Monnier
2023-04-06 16:09                                     ` Max Nikulin
2023-04-06 21:25                                       ` Stefan Monnier
2023-04-19  4:20                                         ` Tom Gillespie
2022-12-25  9:48                                   ` Ihor Radchenko
2022-12-25 11:46                                     ` Max Nikulin
2022-12-26  8:44                                       ` Ihor Radchenko
2022-12-26 11:01                                         ` Ihor Radchenko
2022-12-26 12:25                                           ` Max Nikulin
2022-12-27  9:47                                             ` Ihor Radchenko
2022-12-27  9:56                                               ` Max Nikulin
2023-02-03 11:02                                                 ` Ihor Radchenko
2023-02-03 12:15                                                   ` Eli Zaretskii
2023-02-03 20:01                                                   ` Tim Cross
2023-02-14 22:53                                                     ` Gregor Zattler
2023-02-16 12:14                                                       ` Max Nikulin
2023-02-21  5:22                                                         ` Richard Stallman
2023-02-21 12:32                                                           ` Eli Zaretskii
2023-02-21 17:26                                                             ` Bhavin Gandhi
2023-02-22 10:48                                                               ` Ihor Radchenko
2023-02-22 16:58                                                                 ` Bhavin Gandhi
2023-02-23  9:35                                                                   ` Ihor Radchenko
2023-04-06 15:02                                                   ` Max Nikulin
2022-12-14 14:25                     ` Stefan Monnier
2022-12-14 21:49                   ` Cook, Malcolm
2022-12-09 19:47               ` Cook, Malcolm
2022-12-08 21:50           ` Cook, Malcolm
     [not found]     ` <87o7se74bf.fsf@penguin>
2022-12-08  7:19       ` David Masterson
2022-12-08  9:10     ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR03MB545501C7FB4FA622327017F6A21C9@SJ0PR03MB5455.namprd03.prod.outlook.com \
    --to=dsmasterson@gmail.com \
    --cc=59882@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).