2

I have used a few steps to keep my org-mode updated from elpa. However, it does not seem to work on the newly released org mode 9.5. With Emacs 27.1 under Ubuntu 20.04, the latest org mode I could ever get to is:

Org mode version 9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ /.../.emacs.d/elpa/org-plus-contrib-20210929/)

My steps are:

First, in .emacs.d

rm -rf elpa/

to get rid of all old elpa packages. It's a bit extreme but I want to avoid the mixed install issue. After installing org mode, I will install all other Emacs packages.

Then, I used a one-liner command:

emacs -Q -batch -eval "(progn (require 'package) (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) (package-initialize) (package-refresh-contents) (setq package-load-list '(all)) (package-install 'org) (package-install 'org-plus-contrib))"

I don't know much about elisp and managed to assemble the above based on asking questions here. It has worked for quite some time. But as said earlier, it stopped upgrading org to the latest version from elpa. And I am also getting warnings like this:

IMPORTANT: please install Org from GNU ELPA as Org ELPA will close before Org 9.6

My question is:

How can I change the above script to make org upgrade to the latest 9.5 (and 9.6) elpa versions?

Related:

How to install latest version of org mode?

How to deal with this message : IMPORTANT: please install Org from GNU ELPA as Org ELPA will close before Org 9.6

-- Update --

I removed init.el and then tried suggested command:

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize) (package-refresh-contents) (setq package-load-list '(all)) (package-install 'org))"
Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Package refresh done
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
‘org’ is already installed

then M-x org-version reports:

command-execute: Cannot open load file: No such file or directory, org

tinlyx
  • 1,276
  • 1
  • 12
  • 27
  • Get rid of the Org ELPA entry and the `org-plus-contrib`: `emacs -Q -batch -eval "(progn (require 'package) (package-initialize) (package-refresh-contents) (setq package-load-list '(all)) (package-install 'org))"`. Assuming that works to install 9.5.2, then you can worry about the `contrib` stuff later - do you really need it? – NickD Feb 26 '22 at 23:14
  • @NickD Thanks. I tried your command, pls see update. I also got a few errors `org-fragtog.el:39:1:Error: Cannot open load file: No such file or directory, org` (a similar error about ob-octave). Then, I disabled `init.el` to eliminate other possbilities. – tinlyx Feb 27 '22 at 01:02
  • The `org-fragtog` stuff is because of the missing `contrib` I believe. The `org already installed` message I can reproduce. It seems to be because `(package-desc-p 'org)` returns `nil`, so it seems that the package object is not initialized. When I do it interactively, it installs it fine. So something is missing from the sequence above but I don't know enough about `package` to debug it. Can you try to install it interactively? Start with `emacs -Q` and then do `M-x package-list`, find the `org 9.5.2` package, mark it with `i` and then `x` to run the transaction. – NickD Feb 27 '22 at 02:58
  • @NickD Yes, `emacs -Q` and `M-x package-list-packages` works fine. I can get 9.5.2 installed. Is there a way to trace what happened with the interactive install and replicate it using elisp? Thanks. – tinlyx Feb 27 '22 at 08:16
  • That's what I did to pin it down to `package-desc-p` returning nil in the non-interactive case. There is something that the interactive case does to initialize the package object so that `package-desc-p` returns the description and not nil, but I don't know what that is. I'm hoping that somebody who knows what `package` is doing will pipe up and tell us. – NickD Feb 27 '22 at 13:49

0 Answers0