From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#74410: 31.0.50; completion-at-point doesn't work in custom buffers Date: Thu, 21 Nov 2024 09:54:18 +0200 Organization: LINKOV.NET Message-ID: <87ttc181jp.fsf@mail.linkov.net> References: <871pz62v0o.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="30577"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 74410@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 21 08:57:14 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 1tE23u-0007oz-AN for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Nov 2024 08:57:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE23k-0001fn-LU; Thu, 21 Nov 2024 02:57:04 -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 1tE23i-0001fY-U8 for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 02:57: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 1tE23i-0003vi-Fg for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 02:57:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=wrZLfsfqrb9UnFDujc7WnHDbft0B++hTMt0Z4oljDNI=; b=QCzwfsH68/mRPf5+BYZr7BxndMG6u25uDbVBbO7C+gseKqlRX+i79ONwHKuVuQy6j+/o0jOR6aw04RW2G/QrgXq5nX5RBwXqxRaXWV/1Ackl8PuInUFvWxU4BRaTYZTdxbjiZEgHbF5rFEzOCKHPN2b+Ou0yg7vaALaqe0G1OLtcr6OkLpMGDFSWToMDYEvRXqolBpLe/N0cEeSVmNRVsu1ns+qgRXDENlvL3tnnLqKLXu1mjTjc4xFERzaZbSiDMX8u8Aknl9j8C6kWGDxS4U+1h5CYlctX2BYX5/WnKDPVASgCoL8CJhzwT/TcFlfYE+ftjm6d9/zFat/st5VkIQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE23i-0004EP-9p for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 02:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Nov 2024 07:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74410 X-GNU-PR-Package: emacs Original-Received: via spool by 74410-submit@debbugs.gnu.org id=B74410.173217579716232 (code B ref 74410); Thu, 21 Nov 2024 07:57:02 +0000 Original-Received: (at 74410) by debbugs.gnu.org; 21 Nov 2024 07:56:37 +0000 Original-Received: from localhost ([127.0.0.1]:48977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE23J-0004Dk-0l for submit@debbugs.gnu.org; Thu, 21 Nov 2024 02:56:37 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:35775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE23B-0004DR-Oj for 74410@debbugs.gnu.org; Thu, 21 Nov 2024 02:56:36 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 751C74000E; Thu, 21 Nov 2024 07:56:21 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Wed, 20 Nov 2024 18:31:07 -0500") X-GND-Sasl: juri@linkov.net 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:295714 Archived-At: >> Currently this works only when typing 'M-x completion-at-point RET', >> not by 'M-C-i' that is bound to 'widget-complete'. Maybe >> 'M-C-i' should be rebound to 'completion-at-point' in widgets? > > Maybe it would make even more sense to just remove the `widget-complete` > binding since M-TAB should already be bound appropriately, but the > problem is that we don't know that the code which inserts the widget > into a buffer has properly setup the `completion-at-point-functions` > hook for `completion-at-point` to work. > > Maybe we should try and detect when that is not the case and emit > a warning if so (with the hope to be able to obsolete `widget-complete` > in some future version). Or to make the binding conditional with something like this: diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index ba99847f488..0701442447c 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1079,7 +1079,10 @@ widget-global-map (defvar widget-field-keymap (let ((map (copy-keymap widget-keymap))) (define-key map "\C-k" #'widget-kill-line) - (define-key map "\M-\t" #'widget-complete) + (define-key map "\M-\t" `(menu-item "" 'widget-complete + :filter ,(lambda (cmd) + (unless completion-at-point-functions + cmd)))) (define-key map "\C-m" #'widget-field-activate) ;; Since the widget code uses a `field' property to identify fields, ;; ordinary beginning-of-line does the right thing.