0

I updated my Emacs from 25 to 28.1 version (as part of OS update), and now on startup there is an error

Symbol's value as variable is void: kill-region

as well as a lot of comp warnings. On similar machine same .emacs.d works perfectly, but native compilation is disabled there.

After init.el fails to load, I can call kill-region in scratch and it works.

I found where this error comes from (.emacs.d/core/prelude-editor.el), but if I comment out offending line ((crux-with-region-or-line kill-region)), other errors comes up. So I believe there is some problem with native compilation. I planning to try compile Emacs from sources without native compilation to test that theory.

UPD. Error happening only on second start of Emacs (or rather when there is no compiled .elc files).

Flowneee
  • 237
  • 1
  • 9
  • 1
    This is a guess, but I suspect that library fails to require all of its dependencies, and the native-compilation process has surfaced the issue by virtue of compiling things in a more isolated fashion. – phils Nov 16 '22 at 14:08
  • You mean that it lack some `require` calls? I have zero idea how `kill-region` could not be imported, it is like built-in function. – Flowneee Nov 17 '22 at 13:13
  • Indeed it is. It is not a variable, OTOH (refer back to your error). I strongly suspect a necessary macro definition has not been loaded at compile time. – phils Nov 17 '22 at 13:17

1 Answers1

2

As expected (see earlier comments), it's a missing macro on account of a missing require.

commit 36b3950d7d315736374b1bcb77b3583c9a895fc0
Date:   Mon Apr 11 02:10:23 2022 -0400

    Fix "Symbol's value as variable is void: kill-region" errors in Emacs 29.0.50 (#1356)
diff --git a/core/prelude-editor.el b/core/prelude-editor.el
index 2151048..2a342e8 100644
--- a/core/prelude-editor.el
+++ b/core/prelude-editor.el
@@ -166,6 +166,7 @@
 ;; note - this should be after volatile-highlights is required
 ;; add the ability to cut the current line, without marking it
 (require 'rect)
+(require 'crux)
 (crux-with-region-or-line kill-region)
 
 ;; tramp, for sudo access

https://github.com/bbatsov/prelude/commit/36b3950d7d315736374b1bcb77b3583c9a895fc0

I suggest that you use whichever process is recommended in order to update your prelude installation to the latest code, as I expect other incompatibilities will exist in your current version, given the very large version jump you're making (from Emacs 25 to 28).

phils
  • 48,657
  • 3
  • 76
  • 115
  • Hmmmm, I'm sure I updated it quite recently. However I ran prelude-update again and it worked. Thanks! – Flowneee Nov 24 '22 at 14:50