Giter VIP home page Giter VIP logo

Comments (12)

minad avatar minad commented on August 29, 2024 2

Is this mini-frame related only? Unfortunately I cannot support mini-frame - my experience with that package has been bumpy. Can you please ask on the mini-frame issue tracker, if the mini-frame maintainer @muffinmad can help with this?

Indepenedently I experimented with a vertico-child-frame mode, maybe at some point we get a dedicated package for that (https://gist.github.com/minad/bc68d0b01c8056b45e58da93196ca6bb). But it won't transfer the minibuffer in general to a popup. @BooAA was interested in this too. See also #42 by @Alexander-Miller, who asked for a mini-frame work-around.

from vertico.

minad avatar minad commented on August 29, 2024 2

@mclearc If you want you can a look at my mini-popup prototype, it shows the minibuffer in a child-frame. It should work with Vertico, Selectrum, and regular non-completing read-from-minibuffer commands:

https://github.com/minad/mini-popup/blob/main/mini-popup.el

You may wonder why I am reinventing the wheel here again, but I feel the approach taken by mini-frame is brittle. I am using a different approach, which only replicates the buffer in the child-frame. The mini-frame approach is more bold from what I've seen, since it really moves the minibuffer to the new window with all the problematic implications. That's more complicated and requires advices. And judging from the number of bug reports I've got due to mini-frame in Vertico and Consult the mini-frame approach seems to be problematic. But that could also be the fault of my packages 🤷

mini-popup has a number of open TODOs (no resizing yet!) and it should be considered experimental. But in case you have time, I appreciate if you give it a try (eval/install package, then M-x mini-popup-mode) - just to see if it generally works in your setup. Maybe the approach I am trying won't fly? There is at least one problem - since the minibuffer is not actually moved to the child frame window, size computations based on the window size in the minibuffer will be off, e.g. in Marginalia.

Btw, there is also maple-minibuffer, but in my tests I got errors: https://github.com/honmaple/emacs-maple-minibuffer/blob/master/maple-minibuffer.el. I think it works similarly as mini-frame under the hood.

cc @BooAA @Alexander-Miller @daviwil since you've expressed interest in this

from vertico.

minad avatar minad commented on August 29, 2024

Yes, matches should be shown on no input. This works usually, but maybe mini-frame is problematic. Is it possible to fix the mini-frame size?

from vertico.

mclearc avatar mclearc commented on August 29, 2024

Ok - I'm now having trouble reproducing this. If it recurs I'll let you know but closing issue for now. Thanks for a great package!

from vertico.

mclearc avatar mclearc commented on August 29, 2024

I'm continuing to see this problem, in that it seems to happen every day, but it is difficult to reliably reproduce it. It does not seem to be a function of my vertico settings, which are as follows:

(use-package vertico
  :straight (:type git :host github :repo "minad/vertico" :branch "main")
  :general
  (:keymaps 'vertico-map
   "C-j"    'vertico-next
   "C-S-j"  'vertico-last
   "C-S-k"  'vertico-first
   "C-k"    'vertico-previous)
  :init
  (vertico-mode)
  :config
  ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
  (setq vertico-cycle t))

;; Allow reuse of minibuffer histry (like helm/ivy-resume or selectrum-last
(use-package uchronia
  :straight (:type git :host github :repo "minad/uchronia")
  :hook (after-init . uchronia-mode))

;; A few more useful configurations...
(use-package emacs
  :init
  ;; ;; Add prompt indicator to `completing-read-multiple'.
  (defun crm-indicator (args)
    (cons (concat "[CRM] " (car args)) (cdr args)))
  (advice-add #'completing-read-multiple :filter-args #'crm-indicator)

  ;; Grow and/or shrink minibuffer
  (setq resize-mini-windows t)

  ;; ;; Do not allow the cursor in the minibuffer prompt
  (setq minibuffer-prompt-properties
        '(read-only t cursor-intangible t face minibuffer-prompt))
  (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)

  ;; Enable recursive minibuffers
  (setq enable-recursive-minibuffers t))

My mini-frame settings are:

(use-package mini-frame
  :straight (:type git :host github :repo "muffinmad/emacs-mini-frame")
  :hook (after-init . mini-frame-mode)
  :commands (mini-frame-mode)
  :custom
  (mini-frame-show-parameters `((top    . 0.023)
                                (width  . 0.98)
                                (left   . 0.5)
                                (height . 11)
                                (child-frame-border-width . 15)
                                (internal-border-width . 0)
                                (left-fringe . 20)
                                (right-fringe . 20)
                                ;; set colors for bespoke theme
                                (foreground-color . ,bespoke-strong)
                                (background-color . ,bespoke-subtle)
                                ))

  (mini-frame-advice-functions '(read-from-minibuffer
                                 read-string
                                 completing-read))
  (mini-frame-resize nil)
 ))

It's clearly something to do with the interaction of vertico with mini-frame. If I turn off mini-frame I can see selection candidates again. But I wasn't seeing this with selectrum and mini-frame, which makes me suspect something with what vertico is doing. No errors are thrown, so debug-on-error hasn't helped me track down the issue. Any tips on how I might proceed are welcome!

EDIT: Perhaps one further relevant fact here is that when the mini-frame buffer fails to show candidates the selection prompt shows !/* as if there were some sort of error on input.

from vertico.

muffinmad avatar muffinmad commented on August 29, 2024

@minad But can you support separate minibuffer frame? E.g. in Emacs 28.

emacs -Q --execute "(push '(minibuffer) default-frame-alist)"
M-x package-initialize
M-: (setq resize-mini-frames t)
M-x vertico-mode
M-x

For me it throws Error in post-command-hook (vertico--exhibit): (wrong-type-argument stringp nil) and does not show completions at all.

At the same time selectrum is works fine in this configuration.

from vertico.

minad avatar minad commented on August 29, 2024

@muffinmad Separate minibuffers should work with Vertico. The error you observe is due to your Emacs 28 being a bit outdated. I played a bit around with mini-frame and prototype an alternative approach in my aforementioned mini-popup repository. Now that I understood better the internals I think my prototype is not really comparable to your mini-frame. My mini-popup is rather a simple alternative to ivy-posframe which works for arbitrary minibuffer commands, as long as you don't use EXWM and as long as you use minibuffer-based UI (selectrum, vertico, ivy, etc). In contrast your mini-frame abstracts over all this and aims to support every possible scenario (Completions buffers and freestanding minibuffer frames).

from vertico.

muffinmad avatar muffinmad commented on August 29, 2024

@minad I've compiles recent Emacs 28 and vertico is works fine with separate minibuffer frame. And the completions list is shown on no input with mini-frame mode.

from vertico.

minad avatar minad commented on August 29, 2024

@muffinmad Thanks a lot for checking!

from vertico.

BooAA avatar BooAA commented on August 29, 2024

This is hard to reproduce. Below is what I have tried:

  1. (setq mini-frame-standalone t) ;; this is a buggy option and I enable it intentionally
  2. Call something with many candidates, for example: describe-function or describe-variable, then you may see something like this:
    Screenshot_2021-05-24_22-45-27

This is not 100% reproducible, you might have to try several times.

  1. After 2 is success, now invoke find-file, then you'll get no candidate displayed when no input.
    Screenshot_2021-05-24_22-48-47

I use edebug to trace mini-frame--display and find problem occurs at this line. Actually, child frame displays normally at first but shrinks to height 1 immediately, so this may be a bug related to mini-frame-resize. Hope this helps.

from vertico.

minad avatar minad commented on August 29, 2024

@BooAA Can you please move the mini-frame issue to the mini-frame issue tracker?

from vertico.

BooAA avatar BooAA commented on August 29, 2024

Can you please move the mini-frame issue to the mini-frame issue tracker?

Done.

My mini-popup is rather a simple alternative to ivy-posframe which works for arbitrary minibuffer commands, as long as you don't use EXWM

If I remember right, ivy-posframe can work with EXWM by setting the parent-frame parameters to nil and its author is also an EXWM user. I think same technique applies here.

from vertico.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.