* Completion details and vertical completion format
@ 2022-11-25 9:28 Arash Esbati
2022-11-27 19:29 ` Juri Linkov
0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2022-11-25 9:28 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
Hi all,
I have a question reg. the combination of `completions-detailed' and
`completions-format'. Steps:
• emacs -Q
• eval (setq completions-detailed t)
• Type 'C-h f skip-TAB' which looks like this:
[-- Attachment #2: horizontal-format.png --]
[-- Type: image/png, Size: 24538 bytes --]
[-- Attachment #3: Type: text/plain, Size: 100 bytes --]
• eval (setq completions-format 'vertical)
• Type 'C-h f skip-TAB' now looks like this:
[-- Attachment #4: vertical-format.png --]
[-- Type: image/png, Size: 26538 bytes --]
[-- Attachment #5: Type: text/plain, Size: 160 bytes --]
The second version is very hard to read. Is this the intended behavior?
I tested this with Emacs 29 (d34fc7b7aa); Emacs 28 behaves the same way.
Best, Arash
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion details and vertical completion format
2022-11-25 9:28 Completion details and vertical completion format Arash Esbati
@ 2022-11-27 19:29 ` Juri Linkov
2022-11-28 9:55 ` Arash Esbati
0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2022-11-27 19:29 UTC (permalink / raw)
To: Arash Esbati; +Cc: emacs-devel
> I have a question reg. the combination of `completions-detailed' and
> `completions-format'. Steps:
>
> • emacs -Q
> • eval (setq completions-detailed t)
> • Type 'C-h f skip-TAB' which looks like this:
>
> • eval (setq completions-format 'vertical)
> • Type 'C-h f skip-TAB' now looks like this:
>
> The second version is very hard to read. Is this the intended behavior?
Could you please explain what did you expect to see.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion details and vertical completion format
2022-11-27 19:29 ` Juri Linkov
@ 2022-11-28 9:55 ` Arash Esbati
2022-11-28 10:09 ` Gregory Heytings
0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2022-11-28 9:55 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@linkov.net> writes:
> Could you please explain what did you expect to see.
Ideally, Emacs switches to `one-column' format automatically when
completion candidates have long annotations and keep `vertical' for
short or no annotations.
Best, Arash
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion details and vertical completion format
2022-11-28 9:55 ` Arash Esbati
@ 2022-11-28 10:09 ` Gregory Heytings
2022-11-28 10:42 ` Gregory Heytings
0 siblings, 1 reply; 7+ messages in thread
From: Gregory Heytings @ 2022-11-28 10:09 UTC (permalink / raw)
To: Arash Esbati; +Cc: Juri Linkov, emacs-devel
>> Could you please explain what did you expect to see.
>
> Ideally, Emacs switches to `one-column' format automatically when
> completion candidates have long annotations and keep `vertical' for
> short or no annotations.
>
Even with long annotations there can be enough room for two columns, if
the font is small enough.
That being said, currently the options completions-detailed and
completions-format are incompatible: completions-format vertical has
either no effet (with a small enough font), or a wrong effect (the one on
your screenshots).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion details and vertical completion format
2022-11-28 10:09 ` Gregory Heytings
@ 2022-11-28 10:42 ` Gregory Heytings
2022-11-28 11:05 ` Arash Esbati
0 siblings, 1 reply; 7+ messages in thread
From: Gregory Heytings @ 2022-11-28 10:42 UTC (permalink / raw)
To: Arash Esbati; +Cc: Juri Linkov, emacs-devel
>>> Could you please explain what did you expect to see.
>>
>> Ideally, Emacs switches to `one-column' format automatically when
>> completion candidates have long annotations and keep `vertical' for
>> short or no annotations.
>
> Even with long annotations there can be enough room for two columns, if
> the font is small enough.
>
> That being said, currently the options completions-detailed and
> completions-format are incompatible: completions-format vertical has
> either no effet (with a small enough font), or a wrong effect (the one
> on your screenshots).
>
Arash, does the patch below fix your problem? The current code assumes
"at least 2 columns", but that's wrong when completion candidates become
long enough.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 6bb0fa3ae9..5faa3c8d4e 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2025,8 +2025,8 @@ completion--insert-strings
(window (get-buffer-window (current-buffer) 0))
(wwidth (if window (1- (window-width window)) 79))
(columns (min
- ;; At least 2 columns; at least 2 spaces between columns.
- (max 2 (/ wwidth (+ 2 length)))
+ ;; At least 2 spaces between columns.
+ (max 1 (/ wwidth (+ 2 length)))
;; Don't allocate more columns than we can fill.
;; Windows can't show less than 3 lines anyway.
(max 1 (/ (length strings) 2))))
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Completion details and vertical completion format
2022-11-28 10:42 ` Gregory Heytings
@ 2022-11-28 11:05 ` Arash Esbati
2022-11-28 12:19 ` Gregory Heytings
0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2022-11-28 11:05 UTC (permalink / raw)
To: Gregory Heytings; +Cc: Juri Linkov, emacs-devel
Gregory Heytings <gregory@heytings.org> writes:
> Arash, does the patch below fix your problem? The current code
> assumes "at least 2 columns", but that's wrong when completion
> candidates become long enough.
Thanks for looking at this. Your patch fixes the issue here, I've tried
it with different use cases I have, also with the external package
'marginalia', and it works.
Best, Arash
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion details and vertical completion format
2022-11-28 11:05 ` Arash Esbati
@ 2022-11-28 12:19 ` Gregory Heytings
0 siblings, 0 replies; 7+ messages in thread
From: Gregory Heytings @ 2022-11-28 12:19 UTC (permalink / raw)
To: Arash Esbati; +Cc: Juri Linkov, emacs-devel
>> Arash, does the patch below fix your problem? The current code assumes
>> "at least 2 columns", but that's wrong when completion candidates
>> become long enough.
>
> Thanks for looking at this. Your patch fixes the issue here, I've tried
> it with different use cases I have, also with the external package
> 'marginalia', and it works.
>
Thanks for checking. Now fixed on master.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-28 12:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-25 9:28 Completion details and vertical completion format Arash Esbati
2022-11-27 19:29 ` Juri Linkov
2022-11-28 9:55 ` Arash Esbati
2022-11-28 10:09 ` Gregory Heytings
2022-11-28 10:42 ` Gregory Heytings
2022-11-28 11:05 ` Arash Esbati
2022-11-28 12:19 ` Gregory Heytings
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).