-
Notifications
You must be signed in to change notification settings - Fork 33
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
mini-frame-mode only displays a cut-off first candidate before typing #169
Comments
I see that this behavior happens with fido/ivy/icomplete as well, so guess the issue mostly lies with mini-frame. Feel free to close. |
Hm, maybe it's something else on your side I can't reproduce this. |
It almost works correct with It might be my Emacs version:
|
Ah, then mini-frame might not work correctly with Emacs 28, yet. |
Yeah, seems so, thank you once again! |
Why? I'm using Actually I'm surprised that |
I thought that to be the case since with my quick tests in Emacs 27 I did not see the issues @terlar desribed. I'm happy to help if you find anything that would improve the support of emacs-mini-frame in selectrum. |
Here is receipt to reproduce the issue with mini frame without emacs-mini-frame package:
The mini frame doesn't show completion list unless some input is provided. Maybe you can find solution much quicker than me. |
Thank you, I can reproduce that. I'm currently clueless why it doesn't display the candidates initially. |
Any new ideas about this problem? |
Unfortunately not, someone would have to determine the problem that causes this. I'm not using this myself but I would be happy to help with the fix as soon we know what to fix. |
The issue also happens with |
Because prompt is not empty. Just delete initial text on C-x C-f and candidates list will be hidden.
… The issue also happens with C-x b, but for some reason C-x C-f works correctly.
|
I just tried to investigate this a bit more and discovered you get the same display problems with |
@muffinmad Would it be possible to specify another buffer whose contents should be used for display in the frame? |
I just tried maple-minibuffer which seems to work fine without any additional setup. I haven't looked at the differences to mini-frame-mode, though. |
Because maple-minibuffer uses fixed frame height by default. It is possible (with additional setup) to make mini-frame to show fixed-height frame too. My point was to make selectrum work in this scenario: #169 (comment). If there is some Emacs bug that leads to such behavior, let's spot it and fix on the Emacs side. Btw, with
Sounds like a job for the |
If there is no minibuffer input or the last input character in the buffer is white space the
I agree, so to fix the problem for the mini-frame case we need to figure out the reason for not displaying the |
To make (setq mini-frame-show-parameters
'((left . 0.5)
(top . 0)
(width . 1.0)
;; set height
(height . 10)))
;; disable mini-frame-resize
(setq mini-frame-resize nil) To make (setq maple-minibuffer:height 1) and turn
Can you provide more compact receipt to reproduce the bug, please? By "more compact" I mean without the need to install additional packages. Also can you report the bug to the Emacs developers? |
I'm not dealing with frames usually so I'm not very experienced with their behaviour/settings. I can indeed see the candidates when setting
I will try to come up with a minimal example which demonstrates the display problem. |
Here is a minimal example, thanks for your previous recipe which helped me creating it:
(setq resize-mini-frames t)
(defvar ov (make-overlay (point-min) (point-min) nil t t))
(minibuffer-with-setup-hook
(lambda ()
(move-overlay ov
(point-max)
(point-max)
(current-buffer))
(overlay-put ov 'after-string "\nHey there, I'm hidden initially and will hide again after any space in the input"))
(read-string "Hi? "))
Initially and after any space the overlay text is hidden. |
|
The
At this point the height of the mini-frame is 2 lines: prompt and
Thank you! |
This isn't the case for me. My guess is that this is gnomes fault, I remembered to stumble across dynamic resize problems with posframe in the past, see here. For anyone scrolling this thread for a solution: To work around the problem configure |
After discussion on the mailing list I have another workaround that can be used until an official solution gets released: (define-advice fit-frame-to-buffer (:around (f &rest args) dont-skip-ws-for-mini-frame)
(cl-letf* ((orig (symbol-function #'window-text-pixel-size))
((symbol-function #'window-text-pixel-size)
(lambda (win from to &rest args)
(apply orig
(append (list win from
(if (and (window-minibuffer-p win)
(frame-root-window-p win)
(eq t to))
nil
to))
args)))))
(apply f args))) With this you should be able to get it working with |
@terlar Does the above workaround solve your issue? Looking back your report seems to describe a slightly different behaviour than what I have seen. |
I will have another look. |
@clemera Adding that advice seems to fix the size of the mini-frame to ~25 rows or so for me, meaning it doesn't shrink as the candidate set is narrowed. My mini-frame usage is configured like: (use-package mini-frame
:straight t
:custom
((mini-frame-ignore-commands '(eval-expression "edebug-eval-expression" debugger-eval-expression "^phi-"))
(mini-frame-show-parameters '((top . 10) (width . 0.7) (left . 0.5))))
:config (mini-frame-mode)) (see https://github.com/nuance/dotfiles/blob/master/emacs.d/init.org for my emacs config / https://github.com/nuance/dotfiles/blob/master/straight-package-versions.el for package versions) |
@nuance Thanks, I can't easily test this because as mentioned earlier dynamic resize of child frames does not work for me under gnome at all. But if I don't specify a height I experience something similar to what @terlar described in that every other time it shows only a single line frame. This sounds like there is an additional issue which is different from the one fixed by the advice. @muffinmad do you have the same problem? There seems to be no issue if you specify a height, though as I said I can't test if the dynamic shrinking is working with the child frames mini-frame-mode uses. |
@nuance Do you still have issues if you specify a height in |
@clemera different problem. with the following snippet, I only ever see the input line of the minibuffer (eg "18 Switch to buffer: " if there are 18 buffers, typing input just reduces the match count number but doesn't display candidates) (use-package mini-frame
:straight t
:custom
((mini-frame-ignore-commands '(eval-expression "edebug-eval-expression" debugger-eval-expression "^phi-"))
(mini-frame-show-parameters '((top . 10) (width . 0.7) (left . 0.5) (height . 1))))
:init
(define-advice fit-frame-to-buffer (:around (f &rest args) dont-skip-ws-for-mini-frame)
(cl-letf (((symbol-function #'window-text-pixel-size)
(lambda (win from to &rest args)
(apply #'window-text-pixel-size
(append (list win from (if (window-minibuffer-p win) nil to) args))))))
(apply f args)))
:config (mini-frame-mode)) |
@nuance I think you misinterpreted the meaning of the height parameter which is the number of lines. A value of |
@clemera Ahh, good catch. Setting it to 25 yields the behavior from before (eg same as if height is unset) - the mini-frame is fixed size regardless of number of candidates; eg, it doesn't seem to respect |
Okay, that is the behaviour I get, too. I thought it was Gnomes fault, do you use it? |
Nope, this is on macOS. I'm running something close to the tip of the native-comp branch, fwiw (I think the sha is |
Okay, thanks. I don't know if this is related to selectrum maybe @muffinmad has some more clues. |
No. In
Miniframe shows 10 candidates and changes the size once the candidates list changed. @nuance Your advice (#169 (comment)) is slightly different. Can you please test it with the #169 (comment)? Also please test it on master branch of Emacs. |
@muffinmad Appears to work now! Not sure how I ended up with a different set of advice. For reference, my mini-frame use-package now looks like: (use-package mini-frame
:straight t
:custom
((mini-frame-ignore-commands '(eval-expression "edebug-eval-expression" debugger-eval-expression "^phi-"))
(mini-frame-show-parameters '((top . 10) (width . 0.7) (left . 0.5) (height . 25))))
:init
(define-advice fit-frame-to-buffer (:around (f &rest args) dont-skip-ws-for-mini-frame)
(cl-letf* ((orig (symbol-function #'window-text-pixel-size))
((symbol-function #'window-text-pixel-size)
(lambda (win from to &rest args)
(apply orig
(append (list win from
(if (and (window-minibuffer-p win)
(frame-root-window-p win)
(eq t to))
nil
to))
args)))))
(apply f args)))
:config (mini-frame-mode))
|
@muffinmad Thanks for catching that, I missed that the advice was different! Great, that it works! |
To summarize the insights in this thread:
(define-advice fit-frame-to-buffer (:around (f &rest args) dont-skip-ws-for-mini-frame)
(cl-letf* ((orig (symbol-function #'window-text-pixel-size))
((symbol-function #'window-text-pixel-size)
(lambda (win from to &rest args)
(apply orig
(append (list win from
(if (and (window-minibuffer-p win)
(frame-root-window-p win)
(eq t to))
nil
to))
args)))))
(apply f args))) @terlar Taking these into account the issue seems to be fixed as far as selectrum is concerned, can you confirm? |
@clemera Yes, I can confirm. With the advice it works (with no height every other execution). However also setting the height in |
Thanks! Does the frame also dynamically shrink when you filter down to fewer candidates? What gnome version are you using? |
I'm on On some further tries it does not shrink and when not using a fixed height it stays at the height when the frame was initiated. |
Okay, thanks this is because of the Gnome issue I was talking about, so maybe this should be noted in the |
Absolutely. |
Adding |
Nice! Thanks for discovering that option, I can confirm that it works! |
Is there any chance the requirement to set a height could be removed if
auto resize is true? Is it meant to be a maximum height or minimum height?
It’s a little confusing to me what the meaning of the value is in this case
(I think it’s just nil / not nil for the resize case, with nil somehow
cancelling the resize behavior).
…On Sun, Nov 1, 2020 at 4:28 PM Clemens Radermacher ***@***.***> wrote:
Nice! Thanks for discovering that option, I can confirm that it works!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#169 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACBDBEY7TCTRP3LZJAZPDSNXHIFANCNFSM4PYZVK5Q>
.
|
Thanks to @dgutov for pointing out to that option! |
It is the initial height. Doesn't make much sense if the
Yes. |
Very good! I have updated the wiki, too. Thank you all! |
Thank you for the kind help @clemera with your latest changes at least the thing pops up. Here are the issues I am seeing. Before typing anything it will only show a cut-off version of the default candidate. The frame does not seem to resize when there is only one single candidate (not sure if it should). I haven't used either of these packages before, just trying them out.
Nothing typed:
One character typed:
Only completion:
Every other time the menu is invoked you don't see any candidates:
PS.
I am applying the config suggested in the Wiki.
As well as:
The text was updated successfully, but these errors were encountered: