Skip to content
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

Defining a now-deprecated variable x-gtk-use-system-tooltips #3725

Closed
larstvei opened this issue Jul 20, 2024 · 13 comments
Closed

Defining a now-deprecated variable x-gtk-use-system-tooltips #3725

larstvei opened this issue Jul 20, 2024 · 13 comments

Comments

@larstvei
Copy link
Contributor

Hi,

In Emacs 29, the x-gtk-use-system-tooltips was deprecated in favor of use-system-tooltips. See: https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS.29#n881

In cider, x-gtk-use-system-tooltips is defined as a variable:

(defvar x-gtk-use-system-tooltips)

This breaks compatibility with the PDF Tools package. That is, if I load cider before loading PDF Tools, then it fails with the error:

File mode specification error: (error Don’t know how to make a buffer-local variable an alias: x-gtk-use-system-tooltips)

To me it seems that they have addressed the issue with the renaming of use-system-tooltips here:

vedang/pdf-tools@f9ab15e

but that this conflicts with cider explicitly defining the variable.

My guess would be that cider could fix this in the same way that PDF Tools does it?

@vemv
Copy link
Member

vemv commented Jul 20, 2024

Thanks for the report!

Yes, the original commit looks a little questionable 8b9d666 there are other ways to expect a variable to exist, namely the boundp and symbol-value functions.

Maybe we could have code that checked which of those variables exist and grabs the value of the existing one.

Would you be interested in a PR?

@bbatsov
Copy link
Member

bbatsov commented Jul 20, 2024

Probably we can rely only on use-system-tooltips going forward.

@vemv
Copy link
Member

vemv commented Jul 20, 2024

As long as the CI matrix passes, sure.

I'd just make sure to not use defvar or defvaralias.

@bbatsov
Copy link
Member

bbatsov commented Jul 20, 2024

Ah, scratch this - it wasn't around before Emacs 29 at all. Oh, well - probably we'll have to do this conditional on the Emacs version.

Maybe we could have code that checked which of those variables exist and grabs the value of the existing one.

It won't be as simple as this, as this variable is not present at the time we define it, therefore a check for it will show it's not there. The defvar approach is super common when you want to avoid byte-compilation errors for something that will be loaded on demand.

@larstvei
Copy link
Contributor Author

larstvei commented Jul 20, 2024

Thanks for the super quick response!

I tried replacing the defvar with the following:

(if (and (> emacs-major-version 28)
           (not (boundp 'x-gtk-use-system-tooltips)))
    ;; The x-gtk prefix has been dropped Emacs 29
    (defvaralias 'x-gtk-use-system-tooltips 'use-system-tooltips)
  (defvar x-gtk-use-system-tooltips))

It seems to work fine. I tried byte-compiling to check for errors, and couldn't see any difference. However, I am not running the cider tests properly.

If you are open for a PR, then can submit one, and then perhaps you can help me verify that it doesn't break anything or cause more warnings?

@bbatsov
Copy link
Member

bbatsov commented Jul 20, 2024

Sure.

larstvei added a commit to larstvei/cider that referenced this issue Jul 20, 2024
larstvei added a commit to larstvei/cider that referenced this issue Jul 20, 2024
larstvei added a commit to larstvei/cider that referenced this issue Jul 20, 2024
larstvei added a commit to larstvei/cider that referenced this issue Aug 15, 2024
@vespesa
Copy link

vespesa commented Aug 28, 2024

It seems that this fix breaks the tooltips (at least) in my environment:

  • GNU Emacs 29.4 (build 1, aarch64-apple-darwin23.5.0, NS appkit-2487.60 Version 14.5 (Build 23F79)) of 2024-06-28
  • MacOS Sonoma version 14.6.1

When Emacs is run in full screen, the Cider tooltips are shown in their own fullscreen (aka in a separate Space in Mac parlance). The effect is somewhat disconcerting and makes the tooltips useless. Tooltips in other modes (e.g., elisp) work as expected.

Reverting this issue's commit fixes the tooltips and I have not found any other workaround.

@larstvei
Copy link
Contributor Author

That is unfortunate, and of course a completely unintended consequence! Perhaps the commit should be reverted in wait of a proper fix.

@cch1
Copy link

cch1 commented Oct 31, 2024

I'm reluctantly abandoning tooltips until this is fixed... the screen jitter is unbearable and you will only get fullscreen out of my hands with credible death threats.

@bbatsov
Copy link
Member

bbatsov commented Nov 1, 2024

I totally get this. I'm just not clear what are our options here, as it seems this is caused by an upstream Emacs bug on macOS (as discussed in #3748).

@cch1
Copy link

cch1 commented Nov 1, 2024

I totally get this. I'm just not clear what are our options here, as it seems this is caused by an upstream Emacs bug on macOS (as discussed in #3748).

Thanks for clarifying, @bbatsov . Based on @larstvei 's comment, I thought reverting a cider commit was a feasible solution, but I totally understand if that is impractical.

@bbatsov
Copy link
Member

bbatsov commented Nov 1, 2024

@cch1 We can always revert this change, but if this is impacting only Mac users, I'm not sure it's fair to reintroduce another issue for the other users. Whatever we do - someone will have to deal with some problems.

@cch1
Copy link

cch1 commented Nov 1, 2024

I'm fine with disabling tooltips until the next release of Emacs. Thanks for making these awesome tools!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants