emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Autoload `org-assert-version' and remove org-loaddefs.el
Date: Fri, 02 Dec 2022 23:18:44 -0500	[thread overview]
Message-ID: <87k039glwb.fsf@kyleam.com> (raw)
In-Reply-To: <87r0xi5jx7.fsf@gnu.org>

Bastien writes:

> Kyle Meyer <kyle@kyleam.com> writes:
[...]

>> Every spot that calls org-assert-version is preceded by a line that
>> requires org-macs, so isn't this error likely due to a mixed
>> installation/load-path issue where the wrong/older org-macs is taking
>> precedence?
>
> Yes: I thought `org-assert-version' job was to help catching mixed
> installations, so my reasoning was that, even when an old org-macs
> version has been loaded, autoloading `org-assert-version' would help
> report about mixed installation.

I see.  So your goal isn't to resolve any errors due to mixed
installation but instead to get the more informative error message from
org-assert-version?

I don't think autoloading will help because it will look in the
org-macs file at the front of the load-path, and, in the bad case, that
does not have the org-assert-version definition.

Here's a minimal example:

--8<---------------cut here---------------start------------->8---
#!/bin/sh

set -eu

tdir=$(mktemp -d "${TMPDIR:-/tmp}"/autoload-shadow-test-XXXXXXX)
cd "$tdir"

mkdir a
cat<<'EOF' >a/foo.el
(defun foo-do ()
  (message "foo"))

(provide 'foo)
EOF

mkdir b
echo "(provide 'foo)" >b/foo.el

cat<<'EOF' >test.el
(add-to-list 'load-path
             (concat default-directory (file-name-as-directory "a")))
(add-to-list 'load-path
             (concat default-directory (file-name-as-directory "b")))

(autoload 'foo-do "foo")
(foo-do)
EOF

emacs -Q --batch --load=test.el
--8<---------------cut here---------------end--------------->8---

If I run that, I see:

  Debugger entered--Lisp error: (error "Autoloading file /tmp/autoload-shadow-test-gmlO35u...")
    (foo-do)
    load-with-code-conversion("/tmp/autoload-shadow-test-gmlO35u/test.el" "/tmp/autoload-shadow-test-gmlO35u/test.el" nil t)
    command-line-1(("--load=test.el"))
    command-line()
    normal-top-level()

And commenting out the add-to-list call for b confirms that it works
without the shadowing.

> That said, do you have any idea how to fix the bug people encounter
> when installing Org from ELPA and being bitten by "invalid-function
> org-assert-version"?

Sorry, I don't.  Given a mixed installation where the org-macs at the
front of load-path does _not_ have org-assert-version, I don't see a way
to catch that.  Not helpful at the moment, but I suppose the situation
improves with time as Org versions that do not have org-assert-version
become less abundant.


  reply	other threads:[~2022-12-03  4:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01  7:26 [PATCH] Autoload `org-assert-version' and remove org-loaddefs.el Bastien
2022-12-02  3:38 ` Kyle Meyer
2022-12-02  7:44   ` Bastien
2022-12-03  4:18     ` Kyle Meyer [this message]
2022-12-06  3:54       ` David Masterson
2022-12-06  5:44         ` tomas
2022-12-06  7:13           ` David Masterson
2022-12-07 11:43     ` Ihor Radchenko
2022-12-07 14:08       ` Max Nikulin
2023-03-29 13:38     ` Ihor Radchenko
2023-03-29 16:04       ` Max Nikulin
2023-03-29 16:52         ` Ihor Radchenko
2023-04-01 14:44           ` Max Nikulin
2023-04-02  8:35             ` Ihor Radchenko
2023-04-02 15:59               ` Max Nikulin
2023-04-02 16:44                 ` Ihor Radchenko
2023-04-04 12:08                   ` Max Nikulin
2023-04-04 13:29                     ` Ihor Radchenko
2023-04-05 11:41                       ` Max Nikulin
2023-04-08 16:47           ` Max Nikulin
2023-04-09  8:29             ` Ihor Radchenko
2023-04-10  6:13               ` Max Nikulin
2023-04-10 16:58                 ` Ihor Radchenko
2023-06-04 10:58                   ` Max Nikulin
2022-12-06  3:00   ` David Masterson

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=87k039glwb.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /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).