unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#40750: Use error face for errors
@ 2020-04-21 18:54 ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-01-21 16:06 ` Lars Ingebrigtsen
  2021-11-02  6:31 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 10+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-04-21 18:54 UTC (permalink / raw)
  To: 40750

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 272 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2020-04-21 18:54 bug#40750: Use error face for errors ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-01-21 16:06 ` Lars Ingebrigtsen
  2021-01-21 17:35   ` Basil L. Contovounesios
  2021-09-25  2:41   ` Stefan Kangas
  2021-11-02  6:31 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-21 16:06 UTC (permalink / raw)
  To: ndame; +Cc: 40750

ndame <ndame@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2021-01-21 16:06 ` Lars Ingebrigtsen
@ 2021-01-21 17:35   ` Basil L. Contovounesios
  2021-01-21 17:38     ` Lars Ingebrigtsen
  2021-09-25  2:41   ` Stefan Kangas
  1 sibling, 1 reply; 10+ messages in thread
From: Basil L. Contovounesios @ 2021-01-21 17:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 40750, ndame

Lars Ingebrigtsen <larsi@gnus.org> writes:

> ndame <ndame@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2021-01-21 17:35   ` Basil L. Contovounesios
@ 2021-01-21 17:38     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-21 17:38 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 40750, ndame

"Basil L. Contovounesios" <contovob@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2021-01-21 16:06 ` Lars Ingebrigtsen
  2021-01-21 17:35   ` Basil L. Contovounesios
@ 2021-09-25  2:41   ` Stefan Kangas
  2021-09-25  2:42     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2021-09-25  2:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 40750, ndame

Lars Ingebrigtsen <larsi@gnus.org> writes:

> ndame <ndame@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.)





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2021-09-25  2:41   ` Stefan Kangas
@ 2021-09-25  2:42     ` Lars Ingebrigtsen
  2021-09-25 15:46       ` bug#40750: [External] : " Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-25  2:42 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 40750, ndame

Stefan Kangas <stefan@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: [External] : bug#40750: Use error face for errors
  2021-09-25  2:42     ` Lars Ingebrigtsen
@ 2021-09-25 15:46       ` Drew Adams
  2021-09-25 16:59         ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2021-09-25 15:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Stefan Kangas; +Cc: 40750@debbugs.gnu.org, ndame

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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: [External] : bug#40750: Use error face for errors
  2021-09-25 15:46       ` bug#40750: [External] : " Drew Adams
@ 2021-09-25 16:59         ` Stefan Kangas
  2022-05-23 11:55           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2021-09-25 16:59 UTC (permalink / raw)
  To: Drew Adams, Lars Ingebrigtsen; +Cc: 40750@debbugs.gnu.org, ndame

Drew Adams <drew.adams@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2020-04-21 18:54 bug#40750: Use error face for errors ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-01-21 16:06 ` Lars Ingebrigtsen
@ 2021-11-02  6:31 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 10+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-02  6:31 UTC (permalink / raw)
  To: 40750@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#40750: Use error face for errors
  2021-09-25 16:59         ` Stefan Kangas
@ 2022-05-23 11:55           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-23 11:55 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 40750@debbugs.gnu.org, Drew Adams, ndame

Stefan Kangas <stefan@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-23 11:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 18:54 bug#40750: Use error face for errors ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-21 16:06 ` Lars Ingebrigtsen
2021-01-21 17:35   ` Basil L. Contovounesios
2021-01-21 17:38     ` Lars Ingebrigtsen
2021-09-25  2:41   ` Stefan Kangas
2021-09-25  2:42     ` Lars Ingebrigtsen
2021-09-25 15:46       ` bug#40750: [External] : " Drew Adams
2021-09-25 16:59         ` Stefan Kangas
2022-05-23 11:55           ` Lars Ingebrigtsen
2021-11-02  6:31 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors

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