GNU bug report logs -
#21681
[PATCH] Fix formatting of lexical-binding at eof warning
Previous Next
Reported by: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 13 Oct 2015 22:54:02 UTC
Severity: wishlist
Tags: patch
Merged with 17518,
21307
Found in versions 24.4.50, 25.0.50
Fixed in version 25.0.91
Done: Glenn Morris <rgm <at> gnu.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 21681 in the body.
You can then email your comments to 21681 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Tue, 13 Oct 2015 22:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Noam Postavsky <npostavs <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 13 Oct 2015 22:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Before:
Warning (:warning): : ‘lexical-binding’ at end of file unreliable
After:
Warning (files): foo.el: ‘lexical-binding’ at end of file unreliable
[0001-Fix-formatting-of-lexical-binding-at-eof-warning.patch (text/x-diff, attachment)]
Forcibly Merged 17518 21307 21681.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 13 Oct 2015 22:56:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 14 Oct 2015 16:29:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 13 Oct 2015 18:51:28 -0400
> From: Noam Postavsky <npostavs <at> gmail.com>
>
> Before:
>
> Warning (:warning): : ‘lexical-binding’ at end of file unreliable
>
> After:
>
> Warning (files): foo.el: ‘lexical-binding’ at end of file unreliable
Why 'files', and not something more concrete, like
'file-local-variables'?
Otherwise, LGTM, thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 14 Oct 2015 16:57:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 21681 <at> debbugs.gnu.org (full text, mbox):
On Wed, Oct 14, 2015 at 12:28 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Why 'files', and not something more concrete, like
> 'file-local-variables'?
The docstring for display-warning says the TYPE arg should be a custom group.
display-warning doesn't actually enforce this, and it looks like the
choice of symbol(s) is only relevant to warning-suppress-log-types.
Perhaps the TYPE should be '(files local-variables) so the user can
suppress it along with all files warnings or just suppress it on it's
own, but display-warning only prints the 1st symbol of the list so the
warning text itself wouldn't change.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 14 Oct 2015 17:43:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 14 Oct 2015 12:56:28 -0400
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: 21681 <at> debbugs.gnu.org
>
> On Wed, Oct 14, 2015 at 12:28 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Why 'files', and not something more concrete, like
> > 'file-local-variables'?
>
> The docstring for display-warning says the TYPE arg should be a custom group.
>
> display-warning doesn't actually enforce this, and it looks like the
> choice of symbol(s) is only relevant to warning-suppress-log-types.
> Perhaps the TYPE should be '(files local-variables) so the user can
> suppress it along with all files warnings or just suppress it on it's
> own, but display-warning only prints the 1st symbol of the list so the
> warning text itself wouldn't change.
I find "files" no more explanatory that "warning". If we lack
infrastructure to display meaningful messages that unequivocally point
to the nature of the problem, let's add the missing infrastructure.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 14 Oct 2015 17:48:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 21681 <at> debbugs.gnu.org (full text, mbox):
On Wed, Oct 14, 2015 at 1:42 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> Date: Wed, 14 Oct 2015 12:56:28 -0400
>> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
>> own, but display-warning only prints the 1st symbol of the list so the
>> warning text itself wouldn't change.
>
> I find "files" no more explanatory that "warning". If we lack
> infrastructure to display meaningful messages that unequivocally point
> to the nature of the problem, let's add the missing infrastructure.
How about making display-warning print all TYPE symbols then?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 14 Oct 2015 17:54:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 14 Oct 2015 13:47:40 -0400
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: 21681 <at> debbugs.gnu.org
>
> How about making display-warning print all TYPE symbols then?
Fine with me, but I don't know enough about display-warning and its
uses to tell if this could cause some harm somewhere. Maybe someone
else will know; if you hear no objections in a few days, please go
ahead.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 14 Oct 2015 19:47:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 14 Oct 2015 20:53:39 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 21681 <at> debbugs.gnu.org
>
> > Date: Wed, 14 Oct 2015 13:47:40 -0400
> > From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> > Cc: 21681 <at> debbugs.gnu.org
> >
> > How about making display-warning print all TYPE symbols then?
>
> Fine with me, but I don't know enough about display-warning and its
> uses to tell if this could cause some harm somewhere. Maybe someone
> else will know; if you hear no objections in a few days, please go
> ahead.
Having now looked at the code, I actually don't understand why the
documentation says the symbol should be a custom group. Nothing in
the code enforces that or relies on that, so it sounds like a
gratuitous limitation to me. Names of custom group are usually so
general that they don't really add any useful information to the
message.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Thu, 15 Oct 2015 02:31:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 21681 <at> debbugs.gnu.org (full text, mbox):
On 10/14/15, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Having now looked at the code, I actually don't understand why the
> documentation says the symbol should be a custom group.
I would speculate it's a way to encourage some convergence of warning
types, so that users are able to suppress several at once.
I did an rgrep on the Emacs source tree for display-warning|lwarn,
only 2 calls pass a list for TYPE, both in lisp/progmodes/python.el:
./lisp/progmodes/python.el:2247:
(lwarn
'(python python-shell-prompt-regexp)
./lisp/progmodes/python.el:3443:
(t (lwarn
'(python python-shell-completion-native-turn-on-maybe)
There are several mistaken uses of :warning or :error, and the rest
use a general symbol that says little beyond which package a warning
might be coming from; around half are custom groups, but none very
specific.
Symbols used:
(get 'alloc 'custom-group) ;=> ((gc-cons-threshold custom-variable)
(get 'todo 'custom-group) ;=> nil
(get 'org 'custom-group) ;=> ((org-babel custom-group)...
(get 'initialization 'custom-group) ;=> ((user-emacs-directory-warning
custom-variable)...
(get 'url 'custom-group) ;=> ((url-file custom-group)...
(get 'gnus-server 'custom-group) ;=> nil
(get 'mule 'custom-group) ;=> ((keyboard-coding-system
custom-variable)...
(get 'server 'custom-group) ;=> ((server-use-tcp custom-variable)...
(get 'file-error 'custom-group) ;=> nil
(get 'rmail 'custom-group) ;=> nil
(get 'check-declare 'custom-group) ;=> nil
(get 'smie 'custom-group) ;=> ((smie-blink-matching-inners
custom-variable)...
(get 'bytecomp 'custom-group) ;=> ((emacs-lisp-file-regexp
custom-variable)...
(get 'mail 'custom-group) ;=> ((mail-host-address custom-variable)...
(get 'python 'custom-group) ;=> nil
(get 'erc 'custom-group) ;=> nil
(get 'soap-client 'custom-group) ;=> nil
(get 'custom 'custom-group) ;=> nil
(get 'bzrmerge 'custom-group) ;=> nil
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Sat, 31 Oct 2015 22:37:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 21681 <at> debbugs.gnu.org (full text, mbox):
On Wed, Oct 14, 2015 at 1:47 PM, Noam Postavsky
<npostavs <at> users.sourceforge.net> wrote:
> On Wed, Oct 14, 2015 at 1:42 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>> Date: Wed, 14 Oct 2015 12:56:28 -0400
>>> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
>>> own, but display-warning only prints the 1st symbol of the list so the
>>> warning text itself wouldn't change.
>>
>> I find "files" no more explanatory that "warning". If we lack
>> infrastructure to display meaningful messages that unequivocally point
>> to the nature of the problem, let's add the missing infrastructure.
>
> How about making display-warning print all TYPE symbols then?
I've been playing a bit more with display-warning, and I think the
part in brackets is not supposed to be part of the warning's
explanation, but rather it tells you how to block it. Like gcc's
"[-Wfoo]". The problem with printing all the symbols is that it would
make the warnings using TYPE lists longer, pushing the actual warning
text to the right, and discourage use of more specific TYPEs.
Another possiblity is still to truncate to a single item, but show a
"..." button to expand it, like `eval-last-sexp' does for long lists.
Another thing I've been experimenting with is including buttons with
an action to resolve the problem in the warning text. It seems to work
pretty well, except that because *Warnings* is in special-mode <tab>
isn't bound to forward-button. It could be nice to have a
warnings-mode which does that. It could also bind e.g. `i' to
something like ignore-warning-at-point (which would customize
warning-suppress-types). But I know Emacs supposed to be in feature
freeze so maybe now is not the time to be adding new modes.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Sun, 24 Jan 2016 18:44:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 21681 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I see in the mean time that Glen Morris has changed :warning to 'files
as part of a general display-warnings fix ("Fix some display-warning
usage." 741d0afe021fbe0ff4f3933242526c684ed8c806)
So can we just fix the filename part (see attached) already, surely
this silly bug has been open long enough.
Before:
Warning (files): : ‘lexical-binding’ at end of file unreliable
After:
Warning (files): foo.el: ‘lexical-binding’ at end of file unreliable
[0001-Fix-lexical-binding-at-eof-warning.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Sun, 24 Jan 2016 18:52:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 24 Jan 2016 13:43:04 -0500
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: 21681 <at> debbugs.gnu.org
>
> Warning (files): foo.el: ‘lexical-binding’ at end of file unreliable
^^^^^^^^^^^^^^
But foo.el is not a file in this case.
What is the real-life use case where this is needed for a buffer that
doesn't visit a file?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Sun, 24 Jan 2016 19:35:01 GMT)
Full text and
rfc822 format available.
Message #40 received at 21681 <at> debbugs.gnu.org (full text, mbox):
On Sun, Jan 24, 2016 at 1:51 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> Date: Sun, 24 Jan 2016 13:43:04 -0500
>> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
>> Cc: 21681 <at> debbugs.gnu.org
>>
>> Warning (files): foo.el: ‘lexical-binding’ at end of file unreliable
> ^^^^^^^^^^^^^^
> But foo.el is not a file in this case.
Huh? Yes it is. Perhaps you missed the bug: `display-warning' is
called from inside `with-temp-buffer`, so we need to use `thisbuf' to
reference the original buffer that we are calling
`hack-local-variables' for. Hmm, perhaps my commit message should
have explained that better.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Mon, 25 Jan 2016 17:08:02 GMT)
Full text and
rfc822 format available.
Message #43 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 24 Jan 2016 14:34:31 -0500
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: 21681 <at> debbugs.gnu.org
>
> On Sun, Jan 24, 2016 at 1:51 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >> Date: Sun, 24 Jan 2016 13:43:04 -0500
> >> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> >> Cc: 21681 <at> debbugs.gnu.org
> >>
> >> Warning (files): foo.el: ‘lexical-binding’ at end of file unreliable
> > ^^^^^^^^^^^^^^
> > But foo.el is not a file in this case.
>
> Huh? Yes it is. Perhaps you missed the bug: `display-warning' is
> called from inside `with-temp-buffer`, so we need to use `thisbuf' to
> reference the original buffer that we are calling
> `hack-local-variables' for.
Right, sorry. Yes, let's do that.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Sun, 31 Jan 2016 15:57:01 GMT)
Full text and
rfc822 format available.
Message #46 received at 21681 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Mon, Jan 25, 2016 at 12:07 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> Date: Sun, 24 Jan 2016 14:34:31 -0500
>> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
>>
>> [...] `display-warning' is
>> called from inside `with-temp-buffer`, so we need to use `thisbuf' to
>> reference the original buffer that we are calling
>> `hack-local-variables' for.
>
> Right, sorry. Yes, let's do that.
Ping? Resending with above explanation in commit message.
[0001-Fix-lexical-binding-at-eof-warning.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21681
; Package
emacs
.
(Wed, 03 Feb 2016 17:51:02 GMT)
Full text and
rfc822 format available.
Message #49 received at 21681 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 31 Jan 2016 10:56:28 -0500
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: 21681 <at> debbugs.gnu.org
>
> Ping? Resending with above explanation in commit message.
Thanks, pushed.
bug marked as fixed in version 25.0.91, send any further explanations to
21681 <at> debbugs.gnu.org and Noam Postavsky <npostavs <at> gmail.com>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 03 Feb 2016 18:04:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 03 Mar 2016 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 108 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.