From: Daniel Mendler <mail@daniel-mendler.de>
To: 47771@debbugs.gnu.org
Subject: bug#47771: 27.1; `Info-read-node-name` throws error during completion
Date: Wed, 14 Apr 2021 14:53:46 +0200 [thread overview]
Message-ID: <4d2568fb-adad-6f3e-2684-13ec2cc70457@daniel-mendler.de> (raw)
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
next reply other threads:[~2021-04-14 12:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 12:53 Daniel Mendler [this message]
2021-05-05 14:59 ` bug#47771: 27.1; `Info-read-node-name` throws error during completion Lars Ingebrigtsen
2021-05-05 15:48 ` Daniel Mendler
2021-05-06 9:26 ` Lars Ingebrigtsen
2021-05-06 9:42 ` Daniel Mendler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d2568fb-adad-6f3e-2684-13ec2cc70457@daniel-mendler.de \
--to=mail@daniel-mendler.de \
--cc=47771@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).