From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#68514: 30.0.50; minibuffer-choose-completion + elisp-c-a-p delete next sexp when completing after open paren Date: Wed, 17 Jan 2024 12:20:06 -0500 Message-ID: References: <86ply1npno.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5803"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dmitry@gutov.dev, 68514@debbugs.gnu.org, Juri Linkov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 17 18:21:24 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 1rQ9bP-0001F2-Jv for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Jan 2024 18:21:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQ9b5-0006rP-4Z; Wed, 17 Jan 2024 12:21:03 -0500 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 1rQ9b4-0006rF-4E for bug-gnu-emacs@gnu.org; Wed, 17 Jan 2024 12:21:02 -0500 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 1rQ9b3-0001vI-J8 for bug-gnu-emacs@gnu.org; Wed, 17 Jan 2024 12:21:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQ9b4-0004KO-Au for bug-gnu-emacs@gnu.org; Wed, 17 Jan 2024 12:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jan 2024 17:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68514 X-GNU-PR-Package: emacs Original-Received: via spool by 68514-submit@debbugs.gnu.org id=B68514.170551201616496 (code B ref 68514); Wed, 17 Jan 2024 17:21:02 +0000 Original-Received: (at 68514) by debbugs.gnu.org; 17 Jan 2024 17:20:16 +0000 Original-Received: from localhost ([127.0.0.1]:53213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQ9aJ-0004Hw-NW for submit@debbugs.gnu.org; Wed, 17 Jan 2024 12:20:16 -0500 Original-Received: from mxout6.mail.janestreet.com ([64.215.233.21]:50291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQ9aH-0004HS-Nv for 68514@debbugs.gnu.org; Wed, 17 Jan 2024 12:20:14 -0500 In-Reply-To: (Stefan Monnier's message of "Wed, 17 Jan 2024 11:37:15 -0500") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1705512006; bh=2kNxGkdED7D7SoFwSUVyd3x4cTk3ns8Gg4VFJ58S4Nw=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=p8lvuDfE/KwKj/xCTi2pEvR0+KNzc6WGqGgbshCqZsoAYrlO9KcLfD9OUzDAeOpLv dZRON7dp/KOHKOzQF58zMjlFyHeFBYdWXp4NAethhcE6gB29FCOaHiN4xjaLRCGpjy Yva3TGWNT1a2XeNlohpBhrwT1lAw2Lq5IEwQXAOnIDxSJsQZrkDzztXx+NjqIZZ44m oU2INc72b/C1Oy+9mvNrFZUiZofpVnygh5tkMEU/ZB1VHy2jYXMBRPC4SDp/rMGHoX IfCZCBenoxc39xV8CRh84Fnxj6NnDPJXSbhktBVeNgR/99iz/fV6j61hiH1j6nmPHR uG0rIRSl0NlZg== 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:278397 Archived-At: Stefan Monnier writes: >> If point is already at the start of a sexp (e.g. immediately after an >> open paren) then backward-sexp will not move point and the beginning >> of the completion region would (correctly) be the original point. >> >> forward-sexp, in this case, will move over the next sexp after point >> and include it in the completion region, even if it's a string or >> list. > > The fact that it did not move point is not really the problem. Yes, I agree that's not a problem - it's not something my patch changes. My patch just causes the completion region to not include unrelated lists/strings. (although it can still include whitespace or comments - but deleting those might actually arguably be correct) > The problem is that point may be just before something like whitespace, > so the > > (member (char-syntax (char-after beg)) > '(?\" ?\()) > > doesn't notice that `forward-sexp` will actually jump over a list or > some other such uncompletable sexp. > > I suggest the patch below instead (which also uses `min` to try to make > sure we don't return a BEG..END which doesn't contain point). > > > Stefan > > > - (unless (or (eq beg (point-max)) > - (member (char-syntax (char-after beg)) > - '(?\" ?\())) > + (unless (or (>= beg (point-max)) > + (not (memq (char-syntax (char-after beg)) > + '(?w ?\\ ?_)))) This prevents completion from happening at all when point is right after an open paren and right before whitespace, which currently works, though it has this bug. That doesn't seem like an improvement, and also it reverts 0db2126d7176b0bd1b13d4b0d1cd958c8cf55714 which explicitly did the opposite.