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.
414 stars 26 forks source link

Posframe max-width? #82

Closed ianyepan closed 4 years ago

ianyepan commented 4 years ago

Can I set the maximum width of the ivy-posframe? When I have my emacs as full screen, I felt the drop-down menu is quite unnecessarily large. Perhaps we can use the percentage of the frame width together with a maximum width to avoid having it become too wide (less aesthetically pleasing IMO).

tumashu commented 4 years ago

set ivy-posframe-width and ivy-posframe-height

ianyepan commented 4 years ago

Thanks for the prompt reply! Sadly, I've already tried those two variables but in vain. For context, here's my current ivy-posframe setting:

(use-package ivy-posframe
  :after ivy
  :diminish
  :config
  (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-center))
        ivy-posframe-height-alist '((t . 20))
        ivy-posframe-parameters '((internal-border-width . 10)))
  (ivy-posframe-mode +1))

The height is succesfully changed to 20 after setting ivy-posframe-height-alist, but there doesn't seem to be a variable called ivy-posframe-width-alist.

As you suggested, I've set ivy-posframe-width and ivy-posframe-height as follows:

(use-package ivy-posframe
  :after ivy
  :diminish
  :config
  (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-center))
        ivy-posframe-parameters '((internal-border-width . 10)))

  ;; Sadly no effect
  (setq ivy-posframe-height 50)
  (setq ivy-posframe-width 50)

  (ivy-posframe-mode +1))

When I M-x describe variable the width and height, both are correctly set to 50. There are however no visible differences when compared to the default width and height.

P.s. putting (setq ivy-posframe-height 50) (setq ivy-posframe-width 50) either under :config or :init yield the same results.

tumashu commented 4 years ago

I try to fix this problem, please try again

ianyepan commented 4 years ago

Hi @tumashu I just updated with your commit and the ivy-posframe-width now works as expected!

However, ivy-posframe-height still takes no effect (I'm on macOS, Emacs 27.0.50), but since ivy-posframe-height-alist '((t . 20)) can achieve the same thing, I'll close this issue for now.

Feel free to reopen if you want to track why ivy-posframe-height takes no effect. Thanks again!