GNU bug report logs - #47771
27.1; `Info-read-node-name` throws error during completion

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Wed, 14 Apr 2021 12:54:02 UTC

Severity: minor

Tags: confirmed, fixed

Found in version 27.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47771 in the body.
You can then email your comments to 47771 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47771; Package emacs. (Wed, 14 Apr 2021 12:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Mendler <mail <at> daniel-mendler.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 14 Apr 2021 12:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; `Info-read-node-name` throws error during completion
Date: Wed, 14 Apr 2021 14:53:46 +0200
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




Added tag(s) confirmed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 19 Apr 2021 09:10:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 19 Apr 2021 09:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47771; Package emacs. (Wed, 05 May 2021 15:00:02 GMT) Full text and rfc822 format available.

Message #12 received at 47771 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: 47771 <at> debbugs.gnu.org
Subject: Re: bug#47771: 27.1; `Info-read-node-name` throws error during
 completion
Date: Wed, 05 May 2021 16:59:07 +0200
Daniel Mendler <mail <at> daniel-mendler.de> writes:

> 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)))

Thanks; applied to Emacs 28 (with some minor changes).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 05 May 2021 15:00:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 47771 <at> debbugs.gnu.org and Daniel Mendler <mail <at> daniel-mendler.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 05 May 2021 15:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47771; Package emacs. (Wed, 05 May 2021 15:49:02 GMT) Full text and rfc822 format available.

Message #19 received at 47771 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47771 <at> debbugs.gnu.org
Subject: Re: bug#47771: 27.1; `Info-read-node-name` throws error during
 completion
Date: Wed, 5 May 2021 17:48:33 +0200
On 5/5/21 4:59 PM, Lars Ingebrigtsen wrote:
> Thanks; applied to Emacs 28 (with some minor changes).

Thank you. There is one additional issue I missed in the bug report. If
you call `Info-build-node-completions` with a file without info tags, it
will also throw an error. So maybe it would be better to wrap
`(Info-build-node-completions (Info-find-file file1 nil t))` with
`ignore-errors`?

Daniel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47771; Package emacs. (Thu, 06 May 2021 09:27:02 GMT) Full text and rfc822 format available.

Message #22 received at 47771 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: 47771 <at> debbugs.gnu.org
Subject: Re: bug#47771: 27.1; `Info-read-node-name` throws error during
 completion
Date: Thu, 06 May 2021 11:26:04 +0200
Daniel Mendler <mail <at> daniel-mendler.de> writes:

> Thank you. There is one additional issue I missed in the bug report. If
> you call `Info-build-node-completions` with a file without info tags, it
> will also throw an error. So maybe it would be better to wrap
> `(Info-build-node-completions (Info-find-file file1 nil t))` with
> `ignore-errors`?

Slapping an `ignore-errors' around all that code feels a bit excessive
(it makes debugging hard), so I've instead made
`Info-build-node-completions' a bit more resilient -- it'll catch errors
from `Info-goto-node' instead.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47771; Package emacs. (Thu, 06 May 2021 09:43:02 GMT) Full text and rfc822 format available.

Message #25 received at 47771 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47771 <at> debbugs.gnu.org
Subject: Re: bug#47771: 27.1; `Info-read-node-name` throws error during
 completion
Date: Thu, 6 May 2021 11:42:32 +0200
On 5/6/21 11:26 AM, Lars Ingebrigtsen wrote:
> Slapping an `ignore-errors' around all that code feels a bit excessive
> (it makes debugging hard), so I've instead made
> `Info-build-node-completions' a bit more resilient -- it'll catch errors
> from `Info-goto-node' instead.

I agree with you, the approach you took is better than the
`ignore-errors` sledgehammer. For the same reasons my initial proposal
was to pass noerror to `Info-find-file`. Thank you for applying the fixes!

Daniel




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Jun 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 324 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.