From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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 11:37:15 -0500 Message-ID: References: <86ply1npno.fsf@mail.linkov.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26384"; 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: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 17 17:39: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 1rQ8wm-0006Z9-7j for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Jan 2024 17:39:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQ8wR-000145-19; Wed, 17 Jan 2024 11:39: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 1rQ8wP-00013w-IE for bug-gnu-emacs@gnu.org; Wed, 17 Jan 2024 11:39:01 -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 1rQ8wP-0007Fm-9l for bug-gnu-emacs@gnu.org; Wed, 17 Jan 2024 11:39:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQ8wQ-0003Qt-A8 for bug-gnu-emacs@gnu.org; Wed, 17 Jan 2024 11:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jan 2024 16:39: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.170550950813142 (code B ref 68514); Wed, 17 Jan 2024 16:39:02 +0000 Original-Received: (at 68514) by debbugs.gnu.org; 17 Jan 2024 16:38:28 +0000 Original-Received: from localhost ([127.0.0.1]:53127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQ8vr-0003Ps-OP for submit@debbugs.gnu.org; Wed, 17 Jan 2024 11:38:28 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQ8vo-0003Pe-Oe for 68514@debbugs.gnu.org; Wed, 17 Jan 2024 11:38:25 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C7B8D10001D; Wed, 17 Jan 2024 11:38:17 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1705509496; bh=2UiWBPqnOlOLzRga3ktNuXKly/q5wAat9+QfTcMPJGU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=K0RLITyB+vsb22/OUrFYaOou5Z7kgNrvFPFpOjIS7aPzuKy0wg4gQA2y1byRD2BZT 9Jgn4oKnA+qDuhD66FExzD8lgKdE2jjbjkmGhpY36fEyiYFnEnJeZ/PG53pYn81nKd tpk5wWgOjzCqL3xx0pNLiWDu/iodk/6h/Du+hoRd2Orwkw98doeLM8WzC0c/TCRkzh KNSIJaPDcC2++5QN+bz/tQ50NakP+Vq6U2Wq+vM8GGveOPxd1ePQzzzOaUZURbgH/8 VnR4jFwdkelItIgNUkKNFO57C+TrwBO9ifJPhWCvgI97J8RJeeyVOWxC4a0VI0OQiB IS1c7KtiwqUBA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D2ACA100068; Wed, 17 Jan 2024 11:38:16 -0500 (EST) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C2EBC120A97; Wed, 17 Jan 2024 11:38:16 -0500 (EST) In-Reply-To: (Spencer Baugh's message of "Tue, 16 Jan 2024 14:43:35 -0500") 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:278390 Archived-At: > 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. 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 diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 00910fb67c7..60d58191175 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -657,12 +657,12 @@ elisp-completion-at-point (save-excursion (backward-sexp 1) (skip-chars-forward "`',=E2=80=98#") - (point)) + (min (point) pos)) (scan-error pos))) (end - (unless (or (eq beg (point-max)) - (member (char-syntax (char-after beg)) - '(?\" ?\())) + (unless (or (>=3D beg (point-max)) + (not (memq (char-syntax (char-after beg)) + '(?w ?\\ ?_)))) (condition-case nil (save-excursion (goto-char beg)