-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix byte-compilation warning on Emacs --without-x #2900
Conversation
Thanks. I'm guessing you're referring to the following byte-compiler warnings? In ivy--minibuffer-setup:
ivy.el:2993:42:Warning: assignment to free variable
‘mwheel-scroll-up-function’
ivy.el:2994:44:Warning: assignment to free variable
‘mwheel-scroll-down-function’ Why not BTW, these warnings no longer show up in Emacs 28, because |
This looks like a likely culprit: https://bugs.gnu.org/47162 |
Indeed, Emacs 28 does not complain. We could restrict the change for emacs-major-version ≤ 27 only. Yes, I guess we could It does not prevent It does seem to cause issues in cases when However, I think requiring provides (no pun intended) a generally more strict and informative check at compile and load time. If one happily sets variables while the feature they come from is not actually there, it's fishy. I wouldn't do that. However, If I had to bind a special undeclared variable, I might use cl-declaim special instead of require-ing. These remarks are not crucial and are provided for perspective. |
Sure, but Ivy, Swiper, and Counsel already eagerly load way more packages than is strictly necessary, which causes its own set of headaches. I'd prefer to avoid this wherever possible, even at the expense of having to pacify the byte-compiler.
Then I suggest adding a
Thanks. |
4c09ef1
to
ebb2bd3
Compare
A variable may be defined but unbound:
Whatever. |
What's your point? I suggested the
BTW, |
* ivy.el (ivy--minibuffer-setup): Modify mwheel variables only after the library has been loaded (PR abo-abo#2900). Copyright-paperwork-exempt: yes
ebb2bd3
to
20d78ae
Compare
Thanks! |
@basil-conto For clarity: boundp does not address the concern. mwheel (or any other feature) could defvar a variable (I nevertheless read defvar as “define variable” because for all purposes that's what it does) and expect it to be set by external users. In this case, users should set it even if it's not boundp. The only way to address the concern is to check the feature we're aiming at using is available. |
There's a difference between (defvar my-foo) which only marks (defvar my-foo nil "Doc.") which declares and defines (binds)
Variables that are intended to be set by other packages should generally (if not always, in a One way to work around that is to do (defvar my-foo)
(put 'my-foo 'variable-documentation "Doc.") but again that's generally only useful for package-internal variables, such as In the case of
Sure, so using
Sorry, I don't see how |
This should now be fixed in Emacs 28:
|
Emacs built --without-x doesn't have mwheel when batch-byte-compiling