From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.devel
Subject: Re: Updating *Completions* as you type
Date: Sun, 15 Oct 2023 09:06:55 +0300
Message-ID: <8334ycqv0g.fsf@gnu.org>
References: <87bkd3z9bi.fsf@catern.com> <86cyxjyr1y.fsf@mail.linkov.net>
 <ier34ye4a3x.fsf@janestreet.com> <86r0lxm7um.fsf@mail.linkov.net>
 <87sf6dx954.fsf@catern.com>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="11239"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: emacs-devel@gnu.org
To: sbaugh@catern.com
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 15 08:07:53 2023
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1qruI5-0002ih-IC
	for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Oct 2023 08:07:53 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1qruHP-0001n3-NQ; Sun, 15 Oct 2023 02:07:11 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>) id 1qruHO-0001mp-IF
 for emacs-devel@gnu.org; Sun, 15 Oct 2023 02:07:10 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1qruHO-0002P5-2x; Sun, 15 Oct 2023 02:07:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=68rBK2IgPOTATcrScGtamFeqBwYj/1y6WCApqyF+MAo=; b=ZFNk5h5BytCc
 xrS8VM96zqt/cPKhDrRNUoJwrIsByyWpXQMu4Ehj8EhtiEOLJOO/3TqCltw72SUyfiyXLNtxAYpQS
 o1CN0e7MUiKanZM+WdWVdgjPzWAao8SyLyA14R0dJZRX0BcisQkqcGBlKoEvbpxoQneDp6wE+nWKG
 7Yj6Gbg4Y6Hm4xYTEPR2ch9pDJXc08CtC8DIwdk5US7zqLRfG6FJYGim3DmBfG31nF/9U6VNGW0P5
 poNTL4ARMY2IFs+rcReSKhPAnilPnj6nEImhqyuz1Bag0972RDp0udkz5Xn+686iIQs12pzwtWR9O
 QQdgRaludo+NvqzqcqpgcA==;
In-Reply-To: <87sf6dx954.fsf@catern.com> (sbaugh@catern.com)
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.devel:311475
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/311475>

> From: sbaugh@catern.com
> Date: Sat, 14 Oct 2023 16:05:11 -0400
> 
> Yes, agreed.  Taking inspiration from zcomplete, I wrote this patch to
> provide just this feature, thoughts?

I tried this.  The update is slow (most probably because it works off
the post-command-hook), and the UX is therefore extremely unpleasant
if you type fast enough.

> +(defcustom completions-auto-update t
> +  "If non-nil, update the *Completions* buffer as you type.

Thus _must_ be nil by default.

> +(defconst completions-no-auto-update-commands
> +  '(previous-history-element
> +    next-history-element
> +    previous-line-or-history-element
> +    next-line-or-history-element
> +    completion-at-point
> +    minibuffer-complete-and-exit
> +    minibuffer-force-complete-and-exit
> +    minibuffer-next-completion
> +    minibuffer-previous-completion
> +    minibuffer-choose-completion)
> +  "Commands to skip updating *Completions*")

Why are those excluded?  And why is this a defconst, not a defvar or
defcustom?

> +    (while-no-input
> +      (let ((non-essential t))
                ^^^^^^^^^^^^^^^
Why?

> +        (when (and (get-buffer-window "*Completions*" 0)
> +                   (not (memq this-command completions-no-auto-update-commands)))
> +          (redisplay)
             ^^^^^^^^^^^
Why do you need this?