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#73330: 31.0.50; Incorrect completions for 'cond' clauses Date: Thu, 19 Sep 2024 16:15:56 +0300 Message-ID: <86r09f9437.fsf@gnu.org> References: <86wmj87y9a.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19176"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73330@debbugs.gnu.org To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 19 15:19:06 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 1srH3p-0004on-AD for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Sep 2024 15:19:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srH1e-0007i5-R7; Thu, 19 Sep 2024 09:16:50 -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 1srH1Z-0007Ya-5S for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:16:45 -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 1srH1Y-0001l9-Rp for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:16:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=WAqSXWGITn5z98RZ25MCztPQTBEbPv+eNPApS6J+p4M=; b=W5KnzCU1B2nb02ebw3Giv6dd87uyHOFxQIlZRH3Evjot3ioCHBL6RShTYbh8X3h2lPmKzmmCk938kNpz3ms/BMOIJrTFnzUWCWrFXKTgUywV8q3fQ9kWI51OEszpmsddnyJ7JBXFyXbbViWIZqOPmPTjbP9NeRpEPq4E2Wak0oG8khnWKLO2K1m1AX32y/zrDO0X4LYzqRrZUwfg0QCZf0JFc+xCQqztkIMt4GSVqh77Y4cyi+yUcR7deC0kZ4KJaXOiBqSfaDBNcxhvRLQsa8aIqy0qVxQHwksf3YqbKOS1ZC1ZfduTDpDLmc2lMNthcM2qermNgYPonun0SwKodw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srH1q-0006Xb-7l for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Sep 2024 13:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73330 X-GNU-PR-Package: emacs Original-Received: via spool by 73330-submit@debbugs.gnu.org id=B73330.172675178525062 (code B ref 73330); Thu, 19 Sep 2024 13:17:02 +0000 Original-Received: (at 73330) by debbugs.gnu.org; 19 Sep 2024 13:16:25 +0000 Original-Received: from localhost ([127.0.0.1]:60047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srH1F-0006W9-0j for submit@debbugs.gnu.org; Thu, 19 Sep 2024 09:16:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srH1C-0006Vx-VD for 73330@debbugs.gnu.org; Thu, 19 Sep 2024 09:16:23 -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 1srH0q-0001b4-1m; Thu, 19 Sep 2024 09:16:00 -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=WAqSXWGITn5z98RZ25MCztPQTBEbPv+eNPApS6J+p4M=; b=L3LgZSYPNq3z 0+0I465YKnllhDNx2iIH/Gi+OkTHG814V8EBsUqlzzB4FWvCTgTPezMaBrzJEb9nJH2/0ZB80RiCz XtaeTCnbRJg/Uxnh7HG9gk6HJouOa1bzl0JBrc7GGPUv6bT1Wm/znyrbcXN5M6YXKgbQjclGDPSK3 q/EmKpgtkpFhivZdmXp/BDQQ3NAM/HX4MrckAwJWHwss7qduZVZ6s88ZHsB1xgUY6uV8Vu3O5KjCA BeJvMEPIuxWm3wDcCkCrKxYX+Gb6mpJtXcKR40nwWlllCUkGy5YqzGHvE/slqMUiriHkfUrYSzXTQ kp8JKIHpLIdcp8oIXokAUA==; In-Reply-To: (message from Eshel Yaron on Thu, 19 Sep 2024 14:25:13 +0200) 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:292049 Archived-At: > From: Eshel Yaron > Cc: 73330@debbugs.gnu.org > Date: Thu, 19 Sep 2024 14:25:13 +0200 > > Eli Zaretskii writes: > > >> Date: Wed, 18 Sep 2024 14:36:18 +0200 > >> From: Eshel Yaron via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" > >> > >> 1. emacs -Q > >> 2. Insert "(cond (current-p > >> 3. Hit M-TAB to complete > >> > >> We're completing a symbol in the condition of a cond clause, so it is > >> expected to be completed as a variable, to current-prefix-argument. > >> However, Emacs mistakenly thinks that we're completing a function name, > >> and completes to current-bidi-paragraph-direction. > > > > Thanks. Does the patch below give good results? > > It helps Does "helps" mean the original scenario is fixed? or are there any leftovers in that scenario? > but also seems to cause a regression. With this change I get: > > 1. emacs -Q > 2. Insert "(cond ((current-p" > ^note the additional parenthesis > 3. Hit M-TAB to complete > > This shows an opposite bug: Emacs should complete function names (and > without the change, it does), but with the change we now get variable > name completion. How about the patch below? diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 9bf6f92..63bd685 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -784,13 +784,18 @@ elisp-completion-at-point (list t (elisp--completion-local-symbols) :predicate (lambda (sym) (get sym 'error-conditions)))) - ((and (or ?\( 'let 'let*) + ((and (or ?\( 'let 'let* 'cond 'cond* 'bind*) (guard (save-excursion (goto-char (1- beg)) (when (eq parent ?\() (up-list -1)) (forward-symbol -1) - (looking-at "\\_")))) + (or + (looking-at + "\\_<\\(let\\*?\\|bind\\*\\)\\_>") + (and (not (eq parent ?\()) + (looking-at + "\\_")))))) (list t (elisp--completion-local-symbols) :predicate #'elisp--shorthand-aware-boundp :company-kind (lambda (_) 'variable)