tumashu / ivy-posframe

ivy-posframe is a ivy extension, which let ivy use posframe to show its candidate menu, ivy-posframe is a **GNU ELPA** package.
415 stars 26 forks source link

Check (display-graphic-p) dynamically in advices #53

Closed gagbo closed 5 years ago

gagbo commented 5 years ago

This added check allows to run ivy-posframe in tty and gui emacs during the same session/with the same server.

I think it's not the cleanest way to do it, but I tested it locally (on MacOS) and that works for me at least (aka, same emacs server, I get posframes in gui emacs and classic minibuffer in tty).

Maybe advising the ivy-posframe-advice-alist is the way to go cleaner, I just wanted to propose a change to start with

tumashu commented 5 years ago

Seem to complicated, maybe we have another simple way

tumashu commented 5 years ago

for example, when in tty, auto run ivy-posframe-mode -1

gagbo commented 5 years ago

Is there a hook for whenever you're entering a frame ?

hlissner commented 5 years ago

For complete coverage, we'd likely need one on after-make-frame-functions and focus-in-hook (or after-focus-change-function) to check the display device and toggle ivy-posframe-mode accordingly.

However, I prefer the original proposal for this PR because ivy-posframe-mode is global. A daemon user could open a gui and tty frame side by side, and ivy-posframe would be disabled permanently after the first tty frame.

tumashu commented 5 years ago

@conao3 any suggestion?

gagbo commented 5 years ago

I changed my patch to be cleaner code : an advice which basically takes a predicate and skips the whole advice if false.

Currently hardcoded as (display-graphic-p) but if this is wrong, anything can be used/customized with slight modifications

tumashu commented 5 years ago

merged, thanks!

conao3 commented 5 years ago

I'm sorry I didn't notice your call by GitHub notification. I'm glad this problem has been solved.