From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.bugs Subject: bug#47771: 27.1; `Info-read-node-name` throws error during completion Date: Wed, 14 Apr 2021 14:53:46 +0200 Message-ID: <4d2568fb-adad-6f3e-2684-13ec2cc70457@daniel-mendler.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2826"; mail-complaints-to="usenet@ciao.gmane.io" To: 47771@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 14 14:54:21 2021 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 1lWf2C-0000cr-EH for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Apr 2021 14:54:20 +0200 Original-Received: from localhost ([::1]:41640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWf2B-0002j7-Fe for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Apr 2021 08:54:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWf1u-0002h4-OL for bug-gnu-emacs@gnu.org; Wed, 14 Apr 2021 08:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lWf1u-0008BQ-FU for bug-gnu-emacs@gnu.org; Wed, 14 Apr 2021 08:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lWf1u-00070J-DR for bug-gnu-emacs@gnu.org; Wed, 14 Apr 2021 08:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Apr 2021 12:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47771 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161840483826906 (code B ref -1); Wed, 14 Apr 2021 12:54:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Apr 2021 12:53:58 +0000 Original-Received: from localhost ([127.0.0.1]:33895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWf1q-0006zu-IZ for submit@debbugs.gnu.org; Wed, 14 Apr 2021 08:53:58 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:42954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWf1m-0006zi-KK for submit@debbugs.gnu.org; Wed, 14 Apr 2021 08:53:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWf1m-0002ZE-2c for bug-gnu-emacs@gnu.org; Wed, 14 Apr 2021 08:53:54 -0400 Original-Received: from server.qxqx.de ([2a01:4f8:121:346::180]:52611 helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWf1j-00083g-Ni for bug-gnu-emacs@gnu.org; Wed, 14 Apr 2021 08:53:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date: Message-ID:Subject:From:To:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7mMIy2Nl/mpx/4mLqSv+nUFrhKDa+/et7CITnH3D5R0=; b=UeE3BpocVMJ0ZDIgjxGA01NJ3+ WQZLmpi5oSOWs0aq1r3iMhxPRX4P/uAnKgpg+8mhFDweI/jvbv4gV9K+DBC+QXI29wmb3oTriiyhE GvqHvQzQ/Zy7aDCrKCXoEqL9gv+xCS0lWRWSxJj8AFWJApbgyCLN7RgOsT5XS5n/DlT4=; Content-Language: en-US Received-SPF: pass client-ip=2a01:4f8:121:346::180; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:204007 Archived-At: The function `Info-read-node-name` uses the `Info-read-node-name-1` completion table. The completion table calls `Info-find-file`, which may throw a `user-error` "Info file ... does not exist". Icomplete (and many other completion systems) makes the assumption that completion tables do not fail. Furthermore, completion tables already have a mechanism to report missing completions by returning nil and printing a message. The issue can be reproduced as follows in emacs -Q: 1. M-x icomplete-mode 2. Press "C-h i" 3. Press "g" to run `Info-goto-node` 4. Enter "(boom)" 5. Move around with the cursor left to right or wait until the `icomplete-post-command-hook` fails. In order to fix the issue, the following patch can be applied: diff --git a/info.el b/info-patched.el index 3bed743..42a7fce 100644 --- a/info.el +++ b/info-patched.el @@ -1881,7 +1881,8 @@ See `completing-read' for a description of arguments and usage." (lambda (string pred action) (complete-with-action action - (Info-build-node-completions (Info-find-file file1 nil t)) + (let ((file2 (Info-find-file file1 'noerror t))) + (and file2 (Info-build-node-completions file2))) string pred)) nodename predicate code)))) ;; Otherwise use Info-read-node-completion-table. Alternatively wrap the whole line by `ignore-errors`. The downside of ignoring the error is that now the default completion system error message becomes slightly less meaningful. It shows "No matches" instead of "Info ... not found". In case it is desired to retain the better error messages, a discussion is needed on how completion tables could report their matching failure. Here it is probably sufficient to demote the error to a message. diff --git a/info.el b/info-patched.el index 3bed743..c38abd7 100644 --- a/info.el +++ b/info-patched.el @@ -1881,7 +1881,8 @@ See `completing-read' for a description of arguments and usage." (lambda (string pred action) (complete-with-action action - (Info-build-node-completions (Info-find-file file1 nil t)) + (with-demoted-errors "%S" + (Info-build-node-completions (Info-find-file file1 nil t))) string pred)) nodename predicate code)))) ;; Otherwise use Info-read-node-completion-table. In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2021-02-09, modified by Debian built on 3df710f593d9 Repository revision: b0229d4bbaea7fcddffced393512c650212830db Repository branch: deb/emacs/d/sid/master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Recent messages: Mark set [2 times] Auto-saving...done Mark set [3 times] next-line: End of buffer Mark set Icomplete mode enabled Error in post-command-hook (icomplete-post-command-hook): (user-error "Info file emacs does not exist") Quit