all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* completing-read does not display options in new frames
@ 2023-04-30  9:44 MaGelan
  2023-04-30 23:24 ` Platon Pronko
  0 siblings, 1 reply; 7+ messages in thread
From: MaGelan @ 2023-04-30  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

This is the first time I post on newsgroups so please forgive me if I
am overlooking something and let me know if I break rules.

I have been using Emacs for a year now and I am starting to integrate it
more and more in my workflow. I am still learning elisp so please bear
with me because I have a programming issue.

I do not understand how to make the completing-read function work
properly in a new frame. Whenever I start completing-read in a new frame
what happens is that I do not see the options right away. I have to
either press SPC or a input a character and delete it in order to force
the refresh of the minibuffer and display the options. Here is an
example that should work on any configuration:


(defun test-miniframe-completing-read ()
    "Test miniframe completing read"
    (interactive)
    (with-selected-frame (make-frame '((name . "emacs-miniframe")
    (minibuffer . only)
    (width . 120)
    (height . 33)))
    (unwind-protect
        (let ((choices '("first" "second" "third")))
            (completing-read "Select: " choices))
        (delete-frame))))

(test-miniframe-completing-read)


I am using consult/vertico/orderless framework but my understanding is
that the completing-read is an independent function. I did notice though
that the consult-buffer when started with:

emacsclient -c -e '(consult-buffer)'

has the same problem. The buffer selection is not shown right away.

I tried to use C-h f and inspect the function but, apparently, it is a C
function. So, I do not know how to proceed further here. How do I make
this code work properly both in new frames and in the existing one?

Thank you very much for any help!



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: completing-read does not display options in new frames
  2023-04-30  9:44 completing-read does not display options in new frames MaGelan
@ 2023-04-30 23:24 ` Platon Pronko
  2023-05-01  3:52   ` Ma Gelan
  0 siblings, 1 reply; 7+ messages in thread
From: Platon Pronko @ 2023-04-30 23:24 UTC (permalink / raw)
  To: MaGelan, help-gnu-emacs

On 2023-04-30 17:44, MaGelan wrote:
> Hi,
> 
> This is the first time I post on newsgroups so please forgive me if I
> am overlooking something and let me know if I break rules.
> 
> I have been using Emacs for a year now and I am starting to integrate it
> more and more in my workflow. I am still learning elisp so please bear
> with me because I have a programming issue.
> 
> I do not understand how to make the completing-read function work
> properly in a new frame. Whenever I start completing-read in a new frame
> what happens is that I do not see the options right away. I have to
> either press SPC or a input a character and delete it in order to force
> the refresh of the minibuffer and display the options. Here is an
> example that should work on any configuration:
> 
> 
> (defun test-miniframe-completing-read ()
>      "Test miniframe completing read"
>      (interactive)
>      (with-selected-frame (make-frame '((name . "emacs-miniframe")
>      (minibuffer . only)
>      (width . 120)
>      (height . 33)))
>      (unwind-protect
>          (let ((choices '("first" "second" "third")))
>              (completing-read "Select: " choices))
>          (delete-frame))))
> 
> (test-miniframe-completing-read)
> 
> 
> I am using consult/vertico/orderless framework but my understanding is
> that the completing-read is an independent function. I did notice though
> that the consult-buffer when started with:
> 
> emacsclient -c -e '(consult-buffer)'
> 
> has the same problem. The buffer selection is not shown right away.
> 
> I tried to use C-h f and inspect the function but, apparently, it is a C
> function. So, I do not know how to proceed further here. How do I make
> this code work properly both in new frames and in the existing one?
> 
> Thank you very much for any help!
> 

Hi!

Your test function works for me, choices are shown immediately. Can you provide more details? (your Emacs version, OS used)

Try starting your emacs in "clean" mode:

emacs -Q -l test.el

(test.el contains the minimized setups code, i.e. relevant parts of init.el and test-miniframe-completing-read defun)

This way it will be possible to get a reproducible test case.


I suspect the issue is there's some error or warning, in which case there's a message shown in one of minibuffers for couple seconds, and that delays completing-read.

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: completing-read does not display options in new frames
  2023-04-30 23:24 ` Platon Pronko
@ 2023-05-01  3:52   ` Ma Gelan
  2023-05-01  5:52     ` Platon Pronko
  2023-05-01 11:51     ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Ma Gelan @ 2023-05-01  3:52 UTC (permalink / raw)
  To: Platon Pronko; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 3728 bytes --]

Thank you for trying to help.

I feel that I did not explain my issue well.

I tried this: emacs -Q -l test.el

With test.el having the code.

What I get is two emacs frames. The main frame is on *scratch* buffer,
and the other frame is just a miniframe. If I focus the miniframe I get
the 'Select:' prompt, no options are shown. I expect to see a list of
vertical options but they only show if I press tab. In this case they
show in the other window, because that is the vanilla behavior in emacs,
but In my version I have the completion directly in the minibuffer. In
both cases, my configuration and emacs -Q, the options do not show right
away, which means that I have to actively press Tab to show them.

My question is: How do I show the options without having to press Tab?

I would like to see them listed as soon as the minibuffer shows up.

This happens in the same frame in my config, but it does not happen if
I create a new frame.

Here is more info:

OS: Arch Linux
Emacs: 28.2
WM: Sway 1.8.1



On Mon, May 1, 2023 at 8:24 AM Platon Pronko <platon7pronko@gmail.com>
wrote:

> On 2023-04-30 17:44, MaGelan wrote:
> > Hi,
> >
> > This is the first time I post on newsgroups so please forgive me if I
> > am overlooking something and let me know if I break rules.
> >
> > I have been using Emacs for a year now and I am starting to integrate it
> > more and more in my workflow. I am still learning elisp so please bear
> > with me because I have a programming issue.
> >
> > I do not understand how to make the completing-read function work
> > properly in a new frame. Whenever I start completing-read in a new frame
> > what happens is that I do not see the options right away. I have to
> > either press SPC or a input a character and delete it in order to force
> > the refresh of the minibuffer and display the options. Here is an
> > example that should work on any configuration:
> >
> >
> > (defun test-miniframe-completing-read ()
> >      "Test miniframe completing read"
> >      (interactive)
> >      (with-selected-frame (make-frame '((name . "emacs-miniframe")
> >      (minibuffer . only)
> >      (width . 120)
> >      (height . 33)))
> >      (unwind-protect
> >          (let ((choices '("first" "second" "third")))
> >              (completing-read "Select: " choices))
> >          (delete-frame))))
> >
> > (test-miniframe-completing-read)
> >
> >
> > I am using consult/vertico/orderless framework but my understanding is
> > that the completing-read is an independent function. I did notice though
> > that the consult-buffer when started with:
> >
> > emacsclient -c -e '(consult-buffer)'
> >
> > has the same problem. The buffer selection is not shown right away.
> >
> > I tried to use C-h f and inspect the function but, apparently, it is a C
> > function. So, I do not know how to proceed further here. How do I make
> > this code work properly both in new frames and in the existing one?
> >
> > Thank you very much for any help!
> >
>
> Hi!
>
> Your test function works for me, choices are shown immediately. Can you
> provide more details? (your Emacs version, OS used)
>
> Try starting your emacs in "clean" mode:
>
> emacs -Q -l test.el
>
> (test.el contains the minimized setups code, i.e. relevant parts of
> init.el and test-miniframe-completing-read defun)
>
> This way it will be possible to get a reproducible test case.
>
>
> I suspect the issue is there's some error or warning, in which case
> there's a message shown in one of minibuffers for couple seconds, and that
> delays completing-read.
>
> --
> Best regards,
> Platon Pronko
> PGP 2A62D77A7A2CB94E
>
>

[-- Attachment #2: clean_emacs.png --]
[-- Type: image/png, Size: 23695 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: completing-read does not display options in new frames
  2023-05-01  3:52   ` Ma Gelan
@ 2023-05-01  5:52     ` Platon Pronko
  2023-05-05  7:04       ` MaGelan
  2023-05-01 11:51     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Platon Pronko @ 2023-05-01  5:52 UTC (permalink / raw)
  To: Ma Gelan; +Cc: help-gnu-emacs

On 2023-05-01 11:52, Ma Gelan wrote:
> Thank you for trying to help.
> 
> I feel that I did not explain my issue well.
> 
> I tried this: emacs -Q -l test.el
> 
> With test.el having the code.
> 
> What I get is two emacs frames. The main frame is on *scratch* buffer,
> and the other frame is just a miniframe. If I focus the miniframe I get
> the 'Select:' prompt, no options are shown. I expect to see a list of
> vertical options but they only show if I press tab. In this case they
> show in the other window, because that is the vanilla behavior in emacs,
> but In my version I have the completion directly in the minibuffer. In
> both cases, my configuration and emacs -Q, the options do not show right
> away, which means that I have to actively press Tab to show them.
> 
> My question is: How do I show the options without having to press Tab?
> 
> I would like to see them listed as soon as the minibuffer shows up.
> 
> This happens in the same frame in my config, but it does not happen if
> I create a new frame.
> 
> Here is more info:
> 
> OS: Arch Linux
> Emacs: 28.2
> WM: Sway 1.8.1

On my machine the completions are never shown right away, both in new frame an in current frame.
Here's the code I used to test completions in current frame:

(defun test-this-frame-completing-read ()
   (interactive)
   (completing-read "Select: " '("first" "second" "third")))

;; invoked via M-x test-this-frame-completing-read

My version is a bit newer (30.0.50, a57a8b75f50b), so there might be some changes between versions that resulted in options not being shown immediately.


Maybe you can try using Ivy package? It provides an improved completion backend. I've tested it with the following code, works for me (completions are shown immediately):

(defun test-miniframe-completing-read ()
      "Test miniframe completing read"
      (interactive)
      (with-selected-frame (make-frame '((name . "emacs-miniframe")
      (minibuffer . only)
      (width . 120)
      (height . 33)))
      (unwind-protect
          (let ((choices '("first" "second" "third")))
              (completing-read "Select: " choices))
          (delete-frame))))

(require 'package)
(package-initialize)
(ivy-mode 1)

;; M-x test-miniframe-completing-read




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: completing-read does not display options in new frames
  2023-05-01  3:52   ` Ma Gelan
  2023-05-01  5:52     ` Platon Pronko
@ 2023-05-01 11:51     ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-05-01 11:51 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Ma Gelan <magel4n@gmail.com>
> Date: Mon, 1 May 2023 12:52:09 +0900
> Cc: help-gnu-emacs@gnu.org
> 
> I feel that I did not explain my issue well.
> 
> I tried this: emacs -Q -l test.el
> 
> With test.el having the code.
> 
> What I get is two emacs frames. The main frame is on *scratch* buffer,
> and the other frame is just a miniframe. If I focus the miniframe I get
> the 'Select:' prompt, no options are shown. I expect to see a list of
> vertical options but they only show if I press tab. In this case they
> show in the other window, because that is the vanilla behavior in emacs,
> but In my version I have the completion directly in the minibuffer. In
> both cases, my configuration and emacs -Q, the options do not show right
> away, which means that I have to actively press Tab to show them.
> 
> My question is: How do I show the options without having to press Tab?

You can't, not with the default vanilla completing-read behavior.

You need to understand the concept behind the default Emacs completion
scheme.  It was devised for users who (a) are very fast typists, and
(b) know very well what they want to type, so they don't need any
hints before they start typing.  What they do need is TAB-completion
so that they could type only a small part of input, and have the rest
completed by Emacs for them.

Therefore, there are no completion candidates shown unless you ask for
them, by typing TAB.

> I would like to see them listed as soon as the minibuffer shows up.

Then you need a non-default completion behavior, like ibuffer or
similar.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: completing-read does not display options in new frames
  2023-05-01  5:52     ` Platon Pronko
@ 2023-05-05  7:04       ` MaGelan
  2023-05-05  7:12         ` MaGelan
  0 siblings, 1 reply; 7+ messages in thread
From: MaGelan @ 2023-05-05  7:04 UTC (permalink / raw)
  To: Platon Pronko, Ma Gelan; +Cc: help-gnu-emacs

Platon Pronko <platon7pronko@gmail.com> writes:

Thank you for trying to help but I could not make this work.

I don't know why but even with emacs -Q I cannot show the options right away.

I think that once the completing-read gets the focus, the minbuffer is
blocked and only after I force the refresh with Tab the options are
shown.

I tried with ivy and vertico so far. None of them solve the issue
because it the issue is with the completing-read, I think.


> On 2023-05-01 11:52, Ma Gelan wrote:
>> Thank you for trying to help.
>> 
>> I feel that I did not explain my issue well.
>> 
>> I tried this: emacs -Q -l test.el
>> 
>> With test.el having the code.
>> 
>> What I get is two emacs frames. The main frame is on *scratch* buffer,
>> and the other frame is just a miniframe. If I focus the miniframe I get
>> the 'Select:' prompt, no options are shown. I expect to see a list of
>> vertical options but they only show if I press tab. In this case they
>> show in the other window, because that is the vanilla behavior in emacs,
>> but In my version I have the completion directly in the minibuffer. In
>> both cases, my configuration and emacs -Q, the options do not show right
>> away, which means that I have to actively press Tab to show them.
>> 
>> My question is: How do I show the options without having to press Tab?
>> 
>> I would like to see them listed as soon as the minibuffer shows up.
>> 
>> This happens in the same frame in my config, but it does not happen if
>> I create a new frame.
>> 
>> Here is more info:
>> 
>> OS: Arch Linux
>> Emacs: 28.2
>> WM: Sway 1.8.1
>
> On my machine the completions are never shown right away, both in new frame an in current frame.
> Here's the code I used to test completions in current frame:
>
> (defun test-this-frame-completing-read ()
>    (interactive)
>    (completing-read "Select: " '("first" "second" "third")))
>
> ;; invoked via M-x test-this-frame-completing-read
>
> My version is a bit newer (30.0.50, a57a8b75f50b), so there might be some changes between versions that resulted in options not being shown immediately.
>
>
> Maybe you can try using Ivy package? It provides an improved completion backend. I've tested it with the following code, works for me (completions are shown immediately):
>
> (defun test-miniframe-completing-read ()
>       "Test miniframe completing read"
>       (interactive)
>       (with-selected-frame (make-frame '((name . "emacs-miniframe")
>       (minibuffer . only)
>       (width . 120)
>       (height . 33)))
>       (unwind-protect
>           (let ((choices '("first" "second" "third")))
>               (completing-read "Select: " choices))
>           (delete-frame))))
>
> (require 'package)
> (package-initialize)
> (ivy-mode 1)
>
> ;; M-x test-miniframe-completing-read



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: completing-read does not display options in new frames
  2023-05-05  7:04       ` MaGelan
@ 2023-05-05  7:12         ` MaGelan
  0 siblings, 0 replies; 7+ messages in thread
From: MaGelan @ 2023-05-05  7:12 UTC (permalink / raw)
  To: Platon Pronko; +Cc: help-gnu-emacs

MaGelan <magel4an@gmail.com> writes:

It works! Ivy is able to show the options. You are right.

I forgot to install ivy package when I launched emacs -Q.

Thank you a lot!!

> Platon Pronko <platon7pronko@gmail.com> writes:
>
> Thank you for trying to help but I could not make this work.
>
> I don't know why but even with emacs -Q I cannot show the options right away.
>
> I think that once the completing-read gets the focus, the minbuffer is
> blocked and only after I force the refresh with Tab the options are
> shown.
>
> I tried with ivy and vertico so far. None of them solve the issue
> because it the issue is with the completing-read, I think.
>
>
>> On 2023-05-01 11:52, Ma Gelan wrote:
>>> Thank you for trying to help.
>>> 
>>> I feel that I did not explain my issue well.
>>> 
>>> I tried this: emacs -Q -l test.el
>>> 
>>> With test.el having the code.
>>> 
>>> What I get is two emacs frames. The main frame is on *scratch* buffer,
>>> and the other frame is just a miniframe. If I focus the miniframe I get
>>> the 'Select:' prompt, no options are shown. I expect to see a list of
>>> vertical options but they only show if I press tab. In this case they
>>> show in the other window, because that is the vanilla behavior in emacs,
>>> but In my version I have the completion directly in the minibuffer. In
>>> both cases, my configuration and emacs -Q, the options do not show right
>>> away, which means that I have to actively press Tab to show them.
>>> 
>>> My question is: How do I show the options without having to press Tab?
>>> 
>>> I would like to see them listed as soon as the minibuffer shows up.
>>> 
>>> This happens in the same frame in my config, but it does not happen if
>>> I create a new frame.
>>> 
>>> Here is more info:
>>> 
>>> OS: Arch Linux
>>> Emacs: 28.2
>>> WM: Sway 1.8.1
>>
>> On my machine the completions are never shown right away, both in new frame an in current frame.
>> Here's the code I used to test completions in current frame:
>>
>> (defun test-this-frame-completing-read ()
>>    (interactive)
>>    (completing-read "Select: " '("first" "second" "third")))
>>
>> ;; invoked via M-x test-this-frame-completing-read
>>
>> My version is a bit newer (30.0.50, a57a8b75f50b), so there might be some changes between versions that resulted in options not being shown immediately.
>>
>>
>> Maybe you can try using Ivy package? It provides an improved completion backend. I've tested it with the following code, works for me (completions are shown immediately):
>>
>> (defun test-miniframe-completing-read ()
>>       "Test miniframe completing read"
>>       (interactive)
>>       (with-selected-frame (make-frame '((name . "emacs-miniframe")
>>       (minibuffer . only)
>>       (width . 120)
>>       (height . 33)))
>>       (unwind-protect
>>           (let ((choices '("first" "second" "third")))
>>               (completing-read "Select: " choices))
>>           (delete-frame))))
>>
>> (require 'package)
>> (package-initialize)
>> (ivy-mode 1)
>>
>> ;; M-x test-miniframe-completing-read



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-05  7:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-30  9:44 completing-read does not display options in new frames MaGelan
2023-04-30 23:24 ` Platon Pronko
2023-05-01  3:52   ` Ma Gelan
2023-05-01  5:52     ` Platon Pronko
2023-05-05  7:04       ` MaGelan
2023-05-05  7:12         ` MaGelan
2023-05-01 11:51     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.