GNU bug report logs - #40750
Use error face for errors

Previous Next

Package: emacs;

Reported by: ndame <ndame <at> protonmail.com>

Date: Tue, 21 Apr 2020 18:55:02 UTC

Severity: wishlist

Fixed in version 29.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 40750 in the body.
You can then email your comments to 40750 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#40750; Package emacs. (Tue, 21 Apr 2020 18:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ndame <ndame <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 21 Apr 2020 18:55:02 GMT) Full text and rfc822 format available.

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

From: ndame <ndame <at> protonmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Use error face for errors
Date: Tue, 21 Apr 2020 18:54:23 +0000
[Message part 1 (text/plain, inline)]
There is a standard face: error, which is red by default.

Error messages in emacs should use it. It makes errors more conspicuous in
the echo area and the Messages buffer, distinguishing them from regular messages.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Thu, 21 Jan 2021 16:07:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: ndame <ndame <at> protonmail.com>
Cc: 40750 <at> debbugs.gnu.org
Subject: Re: bug#40750: Use error face for errors
Date: Thu, 21 Jan 2021 17:06:29 +0100
ndame <ndame <at> protonmail.com> writes:

> There is a standard face: error, which is red by default.
>
> Error messages in emacs should use it. It makes errors more conspicuous in
> the echo area and the Messages buffer, distinguishing them from regular
> messages.

I think having Emacs using red for error message in the echo area etc
would look pretty odd?  Anybody got an opinion here?

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Thu, 21 Jan 2021 17:36:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 40750 <at> debbugs.gnu.org, ndame <ndame <at> protonmail.com>
Subject: Re: bug#40750: Use error face for errors
Date: Thu, 21 Jan 2021 17:35:26 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> ndame <ndame <at> protonmail.com> writes:
>
>> There is a standard face: error, which is red by default.
>>
>> Error messages in emacs should use it. It makes errors more conspicuous in
>> the echo area and the Messages buffer, distinguishing them from regular
>> messages.
>
> I think having Emacs using red for error message in the echo area etc
> would look pretty odd?  Anybody got an opinion here?

I agree, but in theory there could be a customisable face for this that
defaults to the current default.

But is it even possible to systematically tell whether a given message
corresponds to an error?

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Thu, 21 Jan 2021 17:40:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 40750 <at> debbugs.gnu.org, ndame <ndame <at> protonmail.com>
Subject: Re: bug#40750: Use error face for errors
Date: Thu, 21 Jan 2021 18:38:52 +0100
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> I agree, but in theory there could be a customisable face for this that
> defaults to the current default.

That's true.

> But is it even possible to systematically tell whether a given message
> corresponds to an error?

I imagined `error' (and `signal'?) putting a face on the return value
from `format-message':

  (signal 'error (list (apply #'format-message args))))

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Sat, 25 Sep 2021 02:42:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 40750 <at> debbugs.gnu.org, ndame <ndame <at> protonmail.com>
Subject: Re: bug#40750: Use error face for errors
Date: Fri, 24 Sep 2021 19:41:11 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> ndame <ndame <at> protonmail.com> writes:
>
>> There is a standard face: error, which is red by default.
>>
>> Error messages in emacs should use it. It makes errors more conspicuous in
>> the echo area and the Messages buffer, distinguishing them from regular
>> messages.
>
> I think having Emacs using red for error message in the echo area etc
> would look pretty odd?  Anybody got an opinion here?

It's hard to say without seeing it in practice.

I think having a face here would be interesting, even if it just looks
like the default face.  That would open the door for experimentation in
third-party themes, and perhaps they will come up with some good ideas
that we will want to imitate.

(See also Bug#50785.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Sat, 25 Sep 2021 02:43:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 40750 <at> debbugs.gnu.org, ndame <ndame <at> protonmail.com>
Subject: Re: bug#40750: Use error face for errors
Date: Sat, 25 Sep 2021 04:42:14 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> I think having a face here would be interesting, even if it just looks
> like the default face.  That would open the door for experimentation in
> third-party themes, and perhaps they will come up with some good ideas
> that we will want to imitate.

Yes, that's a good point.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Sat, 25 Sep 2021 15:47:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Stefan Kangas <stefan <at> marxist.se>
Cc: "40750 <at> debbugs.gnu.org" <40750 <at> debbugs.gnu.org>,
 ndame <ndame <at> protonmail.com>
Subject: RE: [External] : bug#40750: Use error face for errors
Date: Sat, 25 Sep 2021 15:46:44 +0000
> > I think having a face here would be interesting, even if it just
> > looks like the default face.  That would open the door for
> > experimentation in third-party themes, and perhaps they will
> > come up with some good ideas that we will want to imitate.
> 
> Yes, that's a good point.

I disagree.  Globally imposing a single face here,
even if by default it is face `default', is quite
the wrong thing to do.
___

What should be done, I think:

Add a user option, defaulting to no change from
the traditional behavior, which causes error and
warning messages to preserve text properties on
the strings they use.

That lets code construct error messages using
any faces (or no faces) that it judges are
appropriate for a given context.

The option gives users control.  By default
nothing is changed.  The non-default option
value gives code control over the appearance.
___

I said the same thing long ago wrt minibuffer
prompting, and that was unfortunately ignored.
As a result we now have a blanket treatment:
a single face for all minibuffer prompts.

Emacs can easily, and should, do better.  It
should provide more flexibility to code for
messaging.
___

I said the same thing long ago wrt completion
return values.  This was partially implemented,
at least.

Code should be able to control the appearance
of text it uses when interacting with users.
And users should be able to override this or
(better) configure it.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Sat, 25 Sep 2021 17:00:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Drew Adams <drew.adams <at> oracle.com>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "40750 <at> debbugs.gnu.org" <40750 <at> debbugs.gnu.org>,
 ndame <ndame <at> protonmail.com>
Subject: RE: [External] : bug#40750: Use error face for errors
Date: Sat, 25 Sep 2021 09:59:17 -0700
Drew Adams <drew.adams <at> oracle.com> writes:

> Add a user option, defaulting to no change from
> the traditional behavior, which causes error and
> warning messages to preserve text properties on
> the strings they use.

That's not what happens, see Bug#50785.

> Code should be able to control the appearance
> of text it uses when interacting with users.
> And users should be able to override this or
> (better) configure it.

Having a face is exactly the way to give users control over what this
looks like.

Of course, the error face should not just remove any faces that are
already there; that precludes making e.g. keybindings stand out with the
`help-key-binding' face.  So you would need to give the error-message
face lower priority.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Tue, 02 Nov 2021 06:32:01 GMT) Full text and rfc822 format available.

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

From: ndame <laszlomail <at> protonmail.com>
To: "40750 <at> debbugs.gnu.org" <40750 <at> debbugs.gnu.org>
Subject: Re: bug#40750: Use error face for errors
Date: Tue, 02 Nov 2021 06:31:23 +0000
[Message part 1 (text/plain, inline)]
> I think having Emacs using red for error message in the echo area etc would look pretty odd? Anybody got an opinion here?

I don't think it looks odd, it just makes errors more conspicuous which is not a bad thing:

(run-with-idle-timer
0 nil
(lambda ()
(message (propertize "Error in post-command-hook (my-test-post-command): (args-out-of-range 0 1)"
'face 'error))))

But it can have its own face (error-message) to use by error and signal, so people can customize it.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40750; Package emacs. (Mon, 23 May 2022 11:56:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: "40750 <at> debbugs.gnu.org" <40750 <at> debbugs.gnu.org>,
 Drew Adams <drew.adams <at> oracle.com>, ndame <ndame <at> protonmail.com>
Subject: Re: bug#40750: Use error face for errors
Date: Mon, 23 May 2022 13:55:12 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Of course, the error face should not just remove any faces that are
> already there; that precludes making e.g. keybindings stand out with the
> `help-key-binding' face.  So you would need to give the error-message
> face lower priority.

I started poking at this a bit, and I realised that I've never actually
seen an error message that has any kind of face.  And that's because
print_error_message uses princ on the strings we give error/signal, and
princ discards all text properties.

So there's nothing here to merge, really -- the strings, when they come
out of Ferror_message_string, are property-less.

I think.

And users can already alter the look of the error message by just using
command-error-function:

(setq command-error-function
      (lambda (data _ _)
	(message "%s" (propertize (error-message-string data)
				  'face 'error))))

So I don't think there's anything much here to implement, really, unless
we really want to start defaulting error messages to use a particular
face.  And I don't think we want that?

So I'm adding some more pointers to command-error-function from relevant
doc strings, because finding that variable wasn't trivial, and I'm
closing this bug report.

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




bug marked as fixed in version 29.1, send any further explanations to 40750 <at> debbugs.gnu.org and ndame <ndame <at> protonmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 23 May 2022 11:57:01 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. (Tue, 21 Jun 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 281 days ago.

Previous Next


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