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

Bug#987683: crashes with "Wrong type argument: (or eieio-object class), nil, obj"



On 2021-04-29 20:38:53, Nicholas D. Steeves wrote:
> Antoine Beaupré <anarcat@debian.org> writes:
>> On 2021-04-29 13:54:05, Nicholas D. Steeves wrote:
> [snip]
>>> These Emacs >= 27 changes also affect the point in emacs init where
>>> package-enable-at-startup can be set:
>>>
>>>     If non-nil, packages are made available before reading the init file
>>>     (but after reading the early init file).  This means that if you
>>>     wish to set this variable, you must do so in the early init file.
>>>
>>> I think this bug is still valid and actionable even if removing
>>> package-initialize from the minimum reproducer, and/or after moving
>>> package-enable-at-startup to early-init.el makes the bug unreproducible.
>>> If nothing else, it seems like our src:emacs might need a NEWS entry on
>>> the topic, but that said, my suspicion is that lsp-mode could be more
>>> defensive.
>>
>> So what you're saying is that in Emacs >= 27, I don't need the
>> package-initialize anymore and that will fix my bug?
>>
>
> Yup, you don't need to manually call package-initialize anymore; also,
> please see the note about package-enable-at-startup, because that
> variable "must" now be set in the new early-init.el.  AFAICT These easy
> config changes are normal major version migration stuff, but I'm not
> sure if they'll be enough to solve your bug.  Definitely worth a shot
> though!

I still need to get to the office to confirm the fix, but this totally
makes sense. I have a very old Emacs configuration, which I've been
carrying for over two decades at this point. Cruft is bound to creep up
in there, and I'm actually surprised things still work in any meaningful
way. :)

I'm still kind of confused. What's the proper way to (say) setup package
repositories and then `use-package'?

In other words, what's the modern equivalent of this in my
`.emacs.d/init.el`?

(when (require 'package nil t)
  (setq-default
   load-prefer-newer t
   package-enable-at-startup nil)
  (when (< emacs-major-version 27)
    (package-initialize))
  (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/";)
			  ("melpa" . "https://melpa.org/packages/";)))
  ;; in elpa-use-package debian package since stretch
  (unless (package-installed-p 'use-package)
    (package-refresh-contents)
    (package-install 'use-package)))

(eval-when-compile
  (require 'use-package)
  (setq-default
   use-package-always-defer nil
   use-package-always-ensure t))

Note that I added this `(when (< emacs-major-version 27)' blob to try to
workaround the bug. But now it seems that this packaging stuff might
belong to early-init.el? What if I want this config to still work in
Emacs 26?

Thanks for holding my hand through the new millenia. ;)

a.

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of speech
because I have nothing to say."
                        - Edward Snowden


Reply to: