From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70381: [PATCH] New command 'completion-preview-complete' Date: Sun, 14 Apr 2024 15:01:35 +0300 Message-ID: <86plusm9uo.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27206"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70381@debbugs.gnu.org, spacibba@aol.com To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 14 14:03:11 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 ) id 1rvyZj-0006mr-4C for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Apr 2024 14:03:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvyZU-0004cm-Kt; Sun, 14 Apr 2024 08:02:56 -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 ) id 1rvyZT-0004cK-8D for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 08:02:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvyZT-0004Xe-05 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 08:02:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rvyZd-0007sq-Q3 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 08:03:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Apr 2024 12:03:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70381 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70381-submit@debbugs.gnu.org id=B70381.171309612729619 (code B ref 70381); Sun, 14 Apr 2024 12:03:05 +0000 Original-Received: (at 70381) by debbugs.gnu.org; 14 Apr 2024 12:02:07 +0000 Original-Received: from localhost ([127.0.0.1]:34464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvyYc-0007h2-UJ for submit@debbugs.gnu.org; Sun, 14 Apr 2024 08:02:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvyYV-0007ey-Kz for 70381@debbugs.gnu.org; Sun, 14 Apr 2024 08:02:00 -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 ) id 1rvyYE-0004PS-PW; Sun, 14 Apr 2024 08:01:38 -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=AamOZ49D0mZO7c1akSzxkFAnI6SgNMiNG222YpLOIbU=; b=a9OV3J0TlAct iXe9whJF0werE/TFwbMRDFqSJYe6eAxEMf4/0Cq+quvXCIfj+wV+PANF7Rb6OrK+jEgCS/jXos7oF NL8Pni/djdF45Jwrw5DvVJBNN9N56fByE8q28lKFw/nQpQxG/qubzGig37gQP+a8tuuUVhkL8YPV7 Eop7ielsB8xguImGlAC/PYqxBUsYgFuCFJ6sxEdTxYQP6uCw9397CS+UBPBMAdezcOw6+KsP71g60 e7X5TpOD2s4qmYtDL1ZvKdhbt5oqPCwbfjYZ3nJ/gHjoj21/e5w1Bu9Kx1aemHh8pt13qsiMCtdyk yujCJwTEbhwo39ZNJTqwqg==; In-Reply-To: (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283273 Archived-At: > Cc: Ergus > Date: Sun, 14 Apr 2024 13:21:54 +0200 > From: Eshel Yaron via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Following a recent discussion on emacs-devel[0], this patch adds a new > command for Completion Preview mode that completes the symbol at point up > to the longest common prefix of all completion candidates. This patch > also adds a visual indication for the longest common prefix when showing > it as part of the completion preview, so the user can tell how far the new > 'completion-preview-complete' will complete before invoking this command. > For example, if the symbol at point is "foo", and the completion > candidates are "foobar" and "foobaz", then the preview shows "bar" with > the common prefix "ba" highlighted in face 'completion-preview-common'. Thanks. > * lisp/completion-preview.el (completion-preview--try-table): > Return longest common prefix and list of suffixes instead of > list of full candidates. Add illustrative comment. > (completion-preview--capf-wrapper, completion-preview--update) > (completion-preview--show, completion-preview-insert) > (completion-preview-next-candidate): Adjust. > (completion-preview-common): New face. > (completion-preview-exact): Distinguish from 'c-p-common'. > (completion-preview-complete): New command. ^^^^^^^^^^ > (completion-preview-active-mode-map): Bind it. > (completion-preview-mode): Mention it in docstring. > (completion-preview-commands): Add 'c-p-complete'. ^^^^^^^^^^^^ Please don't abbreviate symbols in the log entries. Those are frequently used to search for changes of functions/variables, and such abbreviations defeat those searches. If you are annoyed by the need to type long strings, I usually find M-/ instrumental in reducing that annoyance considerably. > +(defface completion-preview-common > '((((supports :underline t)) > :underline t :inherit completion-preview) > (((supports :weight bold)) > :weight bold :inherit completion-preview) > (t :background "gray")) > - "Face for exact completion preview overlay." > + "Face for completions longest common prefix in the completion preview." ^^^^^^^^^^^ This word is redundant here. I'd replace it with "the". > +(defvar-local completion-preview--inhibit-update-p nil > + "Whether to inhibit updateing the completion preview following this command.") ^^^^^^^^^ "updating" > + (set-text-properties 0 (length suffix) > + `(face ,(if (cdr suffixes) > + 'completion-preview > + 'completion-preview-exact)) > + suffix) > + (set-text-properties 0 (length common) > + `(face ,(if (cdr suffixes) > + 'completion-preview-common > + 'completion-preview-exact)) > + common) Is the use of back-ticks really necessary here? > + (set-text-properties 0 (length suffix) > + `(face ,(if (cdr sufs) > + 'completion-preview > + 'completion-preview-exact)) > + suffix) Likewise here (and in few other places).