bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62762: 'make' often errors with "Org version mismatch" after pulling


From: Stefan Monnier
Subject: bug#62762: 'make' often errors with "Org version mismatch" after pulling a new version of the code
Date: Mon, 01 May 2023 12:49:04 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> May you provide an approximate code for that function?

Something like (guaranteed 100% untested):

    (defun my-require-with-shadow-check (feature &optional reload)
      (if (not (featurep feature))
          (require feature)
        (let ((file (locate-file (symbol-name feature)
                                 load-path (get-load-suffixes))))
          (if (assoc file load-history)
              ;; The desired file is already loaded, we're clear!
              nil
            ;; The feature is already provided, but from some other file
            ;; than expected.  Presumably because `load-path` has been
            ;; changed since the file was loaded.  This is likely a sign
            ;; that we're loading a mix of files from different versions.
            ;; That can spell trouble.
            (if reload
                ;; Try and fix the situation by force-reloading the file
                ;; This may fix the problem but only if that file doesn't
                ;; `require` any other affected file, or if it also
                ;; uses `my-require-with-shadow-check` to similarly reload
                ;; any other affected file.
                (load file nil t t)
              ;; We could try and find the "other/older" file in `load-history`
              ;; to provide better feedback to the user.
              (error "Mixed versions!!"))))))


-- Stefan






reply via email to

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