abo-abo/swiper

Require `transient` module to avoid native compiler warning

med-merchise opened this issue · 2 comments

Native compiler issues:
swiper.el:290:12: Warning: the function ‘static-if’ is not known to be defined.

(static-if (fboundp 'value<)

Adding (require 'transient) at the module top should remove this warning and it will make sure that native compilation is correct.

Native compiler issues:

Ah, this is the key: these warnings only show up in the native compiler.

Adding (require 'transient)

No, transient is not the canonical source of static-if. transient is a library for making menus, whereas static-if is built into Emacs 30, in lisp/subr.el, together with when, unless, etc.: https://git.sv.gnu.org/cgit/emacs.git/tree/lisp/subr.el?id=6480de5ea7#n279

at the module top should remove this warning and it will make sure that native compilation is correct.

There are two better options IMO:

  1. conditionally polyfill static-if at compile time only in swiper.el as well
  2. change the compile-time polyfill of static-if in ivy.el from compile-time only to both compile-time and run-time.

Option 2 is less repetitive, but it also has the drawback of permanently defining static-if in ivy.el. This is what transient is doing, and is probably why you thought that static-if is provided by transient. I would like to avoid this confusion and false association, so I think I'll go for option 1.

This report is about the same problem as #3038, so marking it as duplicate.