From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71716: [PATCH] Add new completion-preview-insert-{word, sexp} commands Date: Wed, 26 Jun 2024 13:41:32 +0200 Message-ID: References: <87a5jd8hqh.fsf@gmail.com> <877ceg9546.fsf@gmail.com> <874j9k8wpo.fsf@gmail.com> <87r0cn5n2s.fsf@gmail.com> <87bk3q5ki8.fsf@gmail.com> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8447"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71716@debbugs.gnu.org To: Jules Tamagnan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 26 13:42:42 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 1sMR2w-0001zX-49 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jun 2024 13:42:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMR2J-0003si-AQ; Wed, 26 Jun 2024 07:42:03 -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 1sMR2G-0003s9-GL for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 07:42:00 -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 1sMR2G-0005Kx-8F for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 07:42:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sMR2I-0005wu-89 for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 07:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jun 2024 11:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71716 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71716-submit@debbugs.gnu.org id=B71716.171940210022832 (code B ref 71716); Wed, 26 Jun 2024 11:42:02 +0000 Original-Received: (at 71716) by debbugs.gnu.org; 26 Jun 2024 11:41:40 +0000 Original-Received: from localhost ([127.0.0.1]:38689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMR1v-0005wC-OR for submit@debbugs.gnu.org; Wed, 26 Jun 2024 07:41:40 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:42572 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMR1t-0005w3-Tr for 71716@debbugs.gnu.org; Wed, 26 Jun 2024 07:41:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1719402094; bh=p8/QSqm47WHY+NDd9tuD77dAIjxl5kdsAL36oeT801o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=waWKnxuSrZq8TPLkNtX2YvStA4A8cN/HTsJvgd0abzOQsNHyriSUM0fs5Jnq174Ld t+fhGfFBoU2Y2Rm8BX8foqPGhbN2Xk01fX1KD/RfoyQgKbqUUAS5YW87sR7tTby5Jq 6YoC0IIjCEqby6ghDiyFQ5ZRjRB2xrwshjVBZWIO3F9yCaa4fp9Bcvrxse+jN57m2u EqrMS/z0TN9D430UNEsC6vInBwudGZ4zpkHxjDt9GFaCf8sFg1MNCYhejQA+NlbDVz SJqwZHo7z3oFmfYApzmsWpBvkUJvGCFC6Q1B3aXvhz2GqooD6BT8IGRdfcfwMr2Euo DhzRwwGRp+zuQ== In-Reply-To: <87bk3q5ki8.fsf@gmail.com> (Jules Tamagnan's message of "Mon, 24 Jun 2024 10:16:31 -0700") X-Hashcash: 1:20:240626:jtamagnan@gmail.com::dSKBq7BsccbvNkpV:0Ih7 X-Hashcash: 1:20:240626:71716@debbugs.gnu.org::AzQa7x+FF/YnFseW:4lpT 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:287931 Archived-At: Hi Jules, Jules Tamagnan writes: > Eshel Yaron writes: > >> One important point is that I'm a bit hesitant about adding the sexp >> variant, rather then defining only completion-preview-insert-word, and >> mentioning in the documentation that other variants are trivial to >> define (and how). The reason is that I don't have a good idea of when >> a completion candidate would span multiple sexps (if you have such an >> example, please share it), so I'm not sure how much utility this >> command would bring in practice. > > The use case that I have for the sexp variant is when completing eshell > history. Both because: parts of shell commands such as file names can be > considered sexp's, but also because eshell itself can interpret "full" > elisp forms. Thanks, I tried it out with cape-history from cape.el and I can see how it may be useful for such use cases. [...] > Another idea would be to turn `c-p-partial-insert` into a macro that > uses the `interactive-form` function to generate a sensible > insert-partial function. I'm more than happy to take this tweak on as > well. That may be a nice addition. In particular we could have a macro that defines a partial insertion command, and takes care of setting the completion-predicate of the defined command such that it's only available when the completion preview is active. [...] > From 74d8efceaf8f64f7cf61e36f8a5e8a4fc86e558d Mon Sep 17 00:00:00 2001 > From: Jules Tamagnan > Date: Mon, 24 Jun 2024 08:53:23 -0700 > Subject: [PATCH] Add new completion-preview-insert-{word,sexp} commands Thank you, pushed to master as commit b3017e7c252, after some tweaks to the commit message. I've also pushed a follow up commit (9cb2a204088) with some minor refinements, see the commit message for details. One notable change is that completion-preview-partial-insert does not force point to the position of the preview overlay ("end") before calling the motion function. This makes completion-preview-insert-word behave more like forward-word when point is in the middle of a multi-word symbol, with the completion preview at the end of that symbol. I've added another test case that demonstrates this behavior. Could you please give it a try to make sure that everything still works as you expect? Thanks, Eshel