minad / marginalia

:scroll: marginalia.el - Marginalia in the minibuffer
GNU General Public License v3.0
780 stars 27 forks source link

Hide annotations in Completions' grid view? #129

Closed protesilaos closed 2 years ago

protesilaos commented 2 years ago

Hello Daniel!

I normally use (setq completions-format 'one-column) which works well with Marginalia. If, however, a vertical or horizontal value is specified, then the annotations mess up with the grid of completion candidates.

Do you think this should be addressed at the Marginalia level, or maybe write some code in my own config?

minad commented 2 years ago

I think it should be handled on the UI level or on the level of the user configuration, since Marginalia currently does not detect the completion UI. But this is actually quite easy to do, you can cycle with marginalia-cycle to the none or builtin annotation function. Ideally you cycle back afterwards, when the minibuffer is closed. In any case, we should document this in the README. I hope this can be done with minimal effort.

minad commented 2 years ago

The simplest approach to get you started is like this:

(add-hook 'minibuffer-setup-hook #'disable-marginalia)
(defun disable-marginalia ()
  (when (and (bound-and-true-p mct--active) (not (eq completions-format 'one-column)))
    (setq-local marginalia-annotator-registry nil)))
minad commented 2 years ago

Prot, I assume it is okay to close this issue? Please let me know if you found a good solution. Then we can document such UI-specific configurations in the README.

protesilaos commented 2 years ago

Prot, I assume it is okay to close this issue?

Yes, please do it. I thought you did it already.

Please let me know if you found a good solution.

I could make it work in the minibuffer both with the code I had and later with the one you shared. It did not work (despite the relevant tweaks) for the completion-in-region case, so I postponed finding a general solution until I have more time for it. Maybe later in the week.

-- Protesilaos Stavrou https://protesilaos.com