GNU bug report logs -
#65891
29.0.91; Could the error msg be better for this?
Previous Next
To reply to this bug, email your comments to 65891 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65891
; Package
emacs
.
(Tue, 12 Sep 2023 15:27:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 12 Sep 2023 15:27:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
A user asked on StackOverflow why s?he got an error with this code.
(https://stackoverflow.com/q/77085788/729907)
(add-hook 'org-mode-hook
#'(lambda () (local-unset-key (kdb "C-j"))))
The problem was the typo: `kdb' instead of `kbd'.
Actually, s?he didn't see the error msg, and was just wondering why
the key `C-j' wasn't getting unset in Org mode.
And the hook function was of course removed after the error was
raised, so the msg was shown only once.
This is the error msg:
File mode specification error: (void-function kdb)
Could we maybe provide a better error msg here?
I'm guessing that it's flagged as a "file mode specification" error
because it's from a mode hook? But major modes are not necessarily
about file buffers. And anyway, "file mode specification" isn't very
clear or helpful, is it? At least to me it doesn't say anything useful,
so far - but maybe with an explanation it will make sense.
If this is a generic error msg from a hook function that raises an error
then maybe it would be better to just say that a hook function raised an
error, if we can't say which hook function raised an error and we can't
pass along the msg from the error that the hook function raised?
I guess "(void-function kdb)" is the error raised by the hook function
(but it's not really a user-targeted message). But why introduce the
error with the mysterious (to me) "File specification error"?
In GNU Emacs 29.0.91 (build 2, x86_64-w64-mingw32) of 2023-05-14 built
on AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19045
System Description: Microsoft Windows 10 Pro (v10.0.2009.19045.3324)
Configured using:
'configure --with-modules --without-dbus --with-native-compilation
--without-compress-install --with-tree-sitter CFLAGS=-O2'
Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB
(NATIVE_COMP present but libgccjit not available)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65891
; Package
emacs
.
(Tue, 12 Sep 2023 15:49:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 65891 <at> debbugs.gnu.org (full text, mbox):
On Sep 12 2023, Drew Adams wrote:
> I'm guessing that it's flagged as a "file mode specification" error
> because it's from a mode hook?
It comes from processing auto-mode-alist, see normal-mode:
(with-demoted-errors "File mode specification error: %s"
(set-auto-mode))
> But major modes are not necessarily about file buffers.
auto-mode-alist is only about matching file names to modes, so the error
message looks fitting.
--
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65891
; Package
emacs
.
(Tue, 12 Sep 2023 17:13:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 65891 <at> debbugs.gnu.org (full text, mbox):
> > I'm guessing that it's flagged as a "file mode specification" error
> > because it's from a mode hook?
>
> It comes from processing auto-mode-alist, see normal-mode:
>
> (with-demoted-errors "File mode specification error: %s"
> (set-auto-mode))
>
> > But major modes are not necessarily about file buffers.
>
> auto-mode-alist is only about matching file names to modes, so the error
> message looks fitting.
Fair enough, I guess. But I still have the question
of whether we can do better here.
Also, I think `C-x b foo' followed by `M-x org-mode'
behaves the same, though no file buffer is involved.
A mode hook doesn't have any necessary relation to any
file or to `auto-mode-alist'. It may be that Emacs
has chosen to relate the two in this way, as a kind of
shortcut, but there's no necessary connection, right?
Severity set to 'minor' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 13 Sep 2023 12:41:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 276 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.