all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys
@ 2021-09-24 18:33 Stefan Kangas
  2021-09-25  2:03 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2021-09-24 18:33 UTC (permalink / raw)
  To: 50785

Severity: minor

In "emacs -Q", if I use the following function:

(defun foo ()
  (interactive)
  (error (substitute-command-keys "Use \\[next-line]")))

The error message says "Use C-n", but "C-n" is not displayed with the
`help-key-binding' face.

In contrast, `message' does not have this problem:

(defun foo2 ()
  (interactive)
  (message (substitute-command-keys "Use \\[next-line]")))

Here, "C-n" is displayed with the correct face.





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

* bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys
  2021-09-24 18:33 bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys Stefan Kangas
@ 2021-09-25  2:03 ` Lars Ingebrigtsen
  2022-08-29 16:29   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-25  2:03 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50785

Stefan Kangas <stefan@marxist.se> writes:

> In "emacs -Q", if I use the following function:
>
> (defun foo ()
>   (interactive)
>   (error (substitute-command-keys "Use \\[next-line]")))
>
> The error message says "Use C-n", but "C-n" is not displayed with the
> `help-key-binding' face.

Hm...  is `error' stripping text properties before displaying, by any
chance?  If so, is there any particular reason why that would make sense
in general?  Hm...  perhaps the idea is that `error' is used in
low-level circumstances, so we don't want to rely on faces etc actually
working?

Anybody know?

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





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

* bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys
  2021-09-25  2:03 ` Lars Ingebrigtsen
@ 2022-08-29 16:29   ` Lars Ingebrigtsen
  2022-08-29 17:32     ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-29 16:29 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50785

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Hm...  is `error' stripping text properties before displaying, by any
> chance?  If so, is there any particular reason why that would make sense
> in general?  Hm...  perhaps the idea is that `error' is used in
> low-level circumstances, so we don't want to rely on faces etc actually
> working?
>
> Anybody know?

The error message are output (by default) by print_error_message.  It
simply does `princ' on the string with a PRINTCHARFUN of t, which is the
minibuffer.  And if you do that, then you lose the text properties:

(defun foo2 ()
  (interactive)
  (princ (substitute-command-keys "Use \\[next-line]") t))

We probably don't want to change something as fundamental as that, so if
we want to fix this, we have to change print_error_message to just call
Fmessage instead, I guess?






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

* bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys
  2022-08-29 16:29   ` Lars Ingebrigtsen
@ 2022-08-29 17:32     ` Stefan Kangas
  2022-08-30 10:25       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2022-08-29 17:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50785

Lars Ingebrigtsen <larsi@gnus.org> writes:

> The error message are output (by default) by print_error_message.  It
> simply does `princ' on the string with a PRINTCHARFUN of t, which is the
> minibuffer.  And if you do that, then you lose the text properties:
>
> (defun foo2 ()
>   (interactive)
>   (princ (substitute-command-keys "Use \\[next-line]") t))
>
> We probably don't want to change something as fundamental as that, so if
> we want to fix this, we have to change print_error_message to just call
> Fmessage instead, I guess?

That's the fix we've used on a Lisp level -- avoiding `princ' in favor
of `insert', etc.

Perhaps it would be nice with a `princ' that preserves text properties?





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

* bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys
  2022-08-29 17:32     ` Stefan Kangas
@ 2022-08-30 10:25       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-30 10:25 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 50785

Stefan Kangas <stefan@marxist.se> writes:

> Perhaps it would be nice with a `princ' that preserves text properties?

Hm, yes -- I guess adding a `print-*' variable for that would make
sense.






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

end of thread, other threads:[~2022-08-30 10:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-24 18:33 bug#50785: 28.0.50; error doesn't use help-key-binding face from substitute-command-keys Stefan Kangas
2021-09-25  2:03 ` Lars Ingebrigtsen
2022-08-29 16:29   ` Lars Ingebrigtsen
2022-08-29 17:32     ` Stefan Kangas
2022-08-30 10:25       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.