Re: How to make Emacs use ELPA version of `compat'?

RangHo Lee <[email protected]> Tue, 12 May 2026 14:49:47 +0900
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
On 5/12/26 8:07 AM, [email protected] wrote:
> RangHo Lee <[email protected]> writes:
> 
>>
>>> Try:
>>>
>>>      1. emacs -Q
>>>      2. C-h v load-path RET
>>>         Confirm that ‘load-path’ contains only the Emacs
>>>         predefined directories.
>>>      3. M-x package-initialize RET
>>>      4. C-h v load-path RET
>>>         Confirm that ‘load-path’ contains the directories of
>>>         your installed packages before the predefined
>>>         directories
>>>      5. Perform whatever test it is that you are using for
>>>         ‘compat’.  If Emacs is still failing to find the newer
>>>         version of ‘compat’, then report your test(s) and
>>>         results to this mailing list.
>>
>> Hmm, odd. When I manually run the steps above, Emacs seems to load the
>> correct version. But when I load my init.el (which uses `use-package' to
>> configure packages, FYI), Emacs suddenly falls back to the built-in version.
>>
>> Now, I suspect the load order is being messed up. Does `use-package'
>> re-arrange the load order based on package dependency?
> 
> You might try the following to localize the expression(s)
> that is not doing what you expect:
> 
>     1. Add the expression (locate-library "compat") to the
> beginning of your init.el file.
> 
>     2. After repeating steps 1-5 above, read your init.el
> file into a buffer (that is, do *not* load it).
> 
>     3. Evaluate the (locate-library "compat") expression to
> confirm that Emacs is finding the ELPA updated version.
> 
>     4. Evaluate each of your remaining expressions in your
> init.el.  After each evaluation, re-evaluate the
> (locate-library "compat") expression to see whether its
> result has changed.  That should help you to locate the
> source of the problem (instead of guessing).
> 
> If you find that a ‘use-package’ expression is the source of
> the problem, then you might be able to use the
> Troubleshooting section of the ‘use-package’ user manual:
> 
>     (info "(use-package) Troubleshooting")
> 

Welp, stupid me. I was able to locate the cause.

Apparently one package that I marked as `:demand t' had `compat' in its 
dependency chain. While it was needed for another package (so I couldn't 
really change the load order), I forced reloading `compat' by:

     (use-package compat
       :pin gnu
       :init
       (unload-feature 'compat t))

...and now Emacs loads the correct version of `compat'.

Thank you for your help and your debug procedure helped a ton!

-- 
RangHo Lee,
Professional procrastinator.

See <https://rangho.me> for more nonsense.