GNU bug report logs - #33682
27.0.50; enriched-mode cannot save anonymous faces

Previous Next

Package: emacs;

Reported by: charles <at> aurox.ch

Date: Sun, 9 Dec 2018 10:24:01 UTC

Severity: wishlist

Found in version 27.0.50

Fixed in version 28.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 33682 in the body.
You can then email your comments to 33682 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#33682; Package emacs. (Sun, 09 Dec 2018 10:24:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to charles <at> aurox.ch:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 09 Dec 2018 10:24:02 GMT) Full text and rfc822 format available.

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

From: charles <at> aurox.ch (Charles A. Roelli)
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; enriched-mode cannot save anonymous faces
Date: Sun, 09 Dec 2018 11:27:15 +0100
C-x C-f /tmp/test-file
M-x enriched-mode RET
M-: (insert (propertize "foo" 'face '(:background "red"))) RET
C-x C-s

Error: Invalid face: :background

The backtrace is:
Debugger entered--Lisp error: (error "Invalid face" :background)
  internal-get-lisp-face-attribute(:background :foreground nil)
  face-attribute(:background :foreground)
  enriched-face-ans(:background)
  enriched-encode-other-face(nil :background)
  format-annotate-atomic-property-change(((bold-italic "bold" "italic") (bold "bold") (italic "italic") (underline "underline") (fixed "fixed") (excerpt "excerpt") (default) (nil enriched-encode-other-face)) nil :background)
  format-annotate-single-property-change(face nil (:background "red") ((face (bold-italic "bold" "italic") (bold "bold") (italic "italic") (underline "underline") (fixed "fixed") (excerpt "excerpt") (default) (nil enriched-encode-other-face)) (left-margin (4 "indent")) (right-margin (4 "indentright")) (justification (none "nofill") (right "flushright") (left "flushleft") (full "flushboth") (center "center")) (PARAMETER (t "param")) (FUNCTION (enriched-decode-foreground "x-color") (enriched-decode-background "x-bg-color") (enriched-decode-display-prop "x-display") (enriched-decode-charset "x-charset")) (read-only (t "x-read-only")) (display (nil enriched-handle-display-prop)) (charset (nil enriched-handle-charset-prop)) (unknown (nil format-annotate-value))))
  format-annotate-location(1 t (front-sticky rear-nonsticky hard) ((face (bold-italic "bold" "italic") (bold "bold") (italic "italic") (underline "underline") (fixed "fixed") (excerpt "excerpt") (default) (nil enriched-encode-other-face)) (left-margin (4 "indent")) (right-margin (4 "indentright")) (justification (none "nofill") (right "flushright") (left "flushleft") (full "flushboth") (center "center")) (PARAMETER (t "param")) (FUNCTION (enriched-decode-foreground "x-color") (enriched-decode-background "x-bg-color") (enriched-decode-display-prop "x-display") (enriched-decode-charset "x-charset")) (read-only (t "x-read-only")) (display (nil enriched-handle-display-prop)) (charset (nil enriched-handle-charset-prop)) (unknown (nil format-annotate-value))))
  format-annotate-region(1 4 ((face (bold-italic "bold" "italic") (bold "bold") (italic "italic") (underline "underline") (fixed "fixed") (excerpt "excerpt") (default) (nil enriched-encode-other-face)) (left-margin (4 "indent")) (right-margin (4 "indentright")) (justification (none "nofill") (right "flushright") (left "flushleft") (full "flushboth") (center "center")) (PARAMETER (t "param")) (FUNCTION (enriched-decode-foreground "x-color") (enriched-decode-background "x-bg-color") (enriched-decode-display-prop "x-display") (enriched-decode-charset "x-charset")) (read-only (t "x-read-only")) (display (nil enriched-handle-display-prop)) (charset (nil enriched-handle-charset-prop)) (unknown (nil format-annotate-value))) enriched-make-annotation (front-sticky rear-nonsticky hard))
  enriched-encode(1 4 #<buffer test-file-3>)
  format-encode-run-method(enriched-encode 1 4 #<buffer test-file-3>)
  format-annotate-function(text/enriched nil nil #<buffer test-file-3> 0)
  write-region(nil nil "/tmp/test-file-3" nil t "/private/tmp/test-file-3")
  basic-save-buffer-2()
  basic-save-buffer-1()
  basic-save-buffer(t)
  save-buffer(1)
  funcall-interactively(save-buffer 1)
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)


In GNU Emacs 27.0.50 (build 8, x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2018-12-09 built on gray
Repository revision: d79bb75683ceb4eee2f753eb38fa8db99aff4568
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1038
System Description:  Mac OS X 10.6.8




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33682; Package emacs. (Sun, 09 Dec 2018 12:57:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: charles <at> aurox.ch
Cc: 33682 <at> debbugs.gnu.org
Subject: Re: bug#33682: 27.0.50; enriched-mode cannot save anonymous faces
Date: Sun, 09 Dec 2018 14:55:39 +0200
> Date: Sun, 09 Dec 2018 11:27:15 +0100
> From: charles <at> aurox.ch (Charles A. Roelli)
> 
> C-x C-f /tmp/test-file
> M-x enriched-mode RET
> M-: (insert (propertize "foo" 'face '(:background "red"))) RET
> C-x C-s
> 
> Error: Invalid face: :background

Thanks.

When setting colors and other properties in Enriched mode, you are
supposed to use commands from facemenu.el (and/or the menu-bar menu
items it produces, under Edit->Text Properties).

The immediate reason for the error is that you should do this instead:

  M-: (insert (propertize "foo" 'face '((:background "red")))) RET

but I'm not sure we want to extend enriched.el to support arbitrary
face specs.  What is the real-life use case for that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33682; Package emacs. (Sun, 09 Dec 2018 16:32:01 GMT) Full text and rfc822 format available.

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

From: charles <at> aurox.ch (Charles A. Roelli)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 33682 <at> debbugs.gnu.org
Subject: Re: bug#33682: 27.0.50; enriched-mode cannot save anonymous faces
Date: Sun, 09 Dec 2018 17:35:28 +0100
> Date: Sun, 09 Dec 2018 14:55:39 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> CC: 33682 <at> debbugs.gnu.org
>
> Thanks.
> 
> When setting colors and other properties in Enriched mode, you are
> supposed to use commands from facemenu.el (and/or the menu-bar menu
> items it produces, under Edit->Text Properties).
> 
> The immediate reason for the error is that you should do this instead:
> 
>   M-: (insert (propertize "foo" 'face '((:background "red")))) RET

Thanks for pointing this out.  So enriched mode can save a face
property which is a list of (possibly anonymous) faces, but it chokes
on a single anonymous face.  Is that documented somewhere?

> but I'm not sure we want to extend enriched.el to support arbitrary
> face specs.  What is the real-life use case for that?

Text created by other programs may not be aware of enriched mode's
limitations.  For example, here is an (abbreviated) version of how I
found this bug (from emacs-26):

C-x C-f test/manual/indent/css-mode.css
M-x enriched-mode RET y
C-x C-s

Evidently some text in CSS buffers is fontified with a single
anonymous face, which enriched mode does not support.  For a real-life
use case, if you copy some text from a CSS buffer and yank it in an
enriched mode buffer, the buffer can (temporarily) no longer be saved.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33682; Package emacs. (Sun, 09 Dec 2018 17:01:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: charles <at> aurox.ch
Cc: 33682 <at> debbugs.gnu.org
Subject: Re: bug#33682: 27.0.50; enriched-mode cannot save anonymous faces
Date: Sun, 09 Dec 2018 19:00:26 +0200
> Date: Sun, 09 Dec 2018 17:35:28 +0100
> From: charles <at> aurox.ch (Charles A. Roelli)
> CC: 33682 <at> debbugs.gnu.org
> 
> >   M-: (insert (propertize "foo" 'face '((:background "red")))) RET
> 
> Thanks for pointing this out.  So enriched mode can save a face
> property which is a list of (possibly anonymous) faces, but it chokes
> on a single anonymous face.  Is that documented somewhere?

I think the limitation might actually be in format.el, but I didn't
dig deep enough.  Enriched mode is under-used (IMO), and format.el is
even less so, so I'm not surprised they don't support yanking text
with faces from other modes.

> Text created by other programs may not be aware of enriched mode's
> limitations.  For example, here is an (abbreviated) version of how I
> found this bug (from emacs-26):
> 
> C-x C-f test/manual/indent/css-mode.css
> M-x enriched-mode RET y
> C-x C-s
> 
> Evidently some text in CSS buffers is fontified with a single
> anonymous face, which enriched mode does not support.  For a real-life
> use case, if you copy some text from a CSS buffer and yank it in an
> enriched mode buffer, the buffer can (temporarily) no longer be saved.

You (and everyone else) are welcome to work on lifting these
limitations, of course.  Maybe that will make enriched.el more
popular, although I wouldn't hold my breath.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33682; Package emacs. (Wed, 11 Aug 2021 20:31:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: charles <at> aurox.ch (Charles A. Roelli)
Cc: 33682 <at> debbugs.gnu.org
Subject: Re: bug#33682: 27.0.50; enriched-mode cannot save anonymous faces
Date: Wed, 11 Aug 2021 22:29:52 +0200
charles <at> aurox.ch (Charles A. Roelli) writes:

> C-x C-f /tmp/test-file
> M-x enriched-mode RET
> M-: (insert (propertize "foo" 'face '(:background "red"))) RET
> C-x C-s
>
> Error: Invalid face: :background
>
> The backtrace is:
> Debugger entered--Lisp error: (error "Invalid face" :background)
>   internal-get-lisp-face-attribute(:background :foreground nil)

This should now be fixed in Emacs 28.

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




bug marked as fixed in version 28.1, send any further explanations to 33682 <at> debbugs.gnu.org and charles <at> aurox.ch Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 Aug 2021 20:31: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, 09 Sep 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 230 days ago.

Previous Next


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