Subject: bug#19903: 24.4; wrong-type-argument symbolp "bold" during enriched-encode

From: Ivan Shmakov <[email-masked]>
Date: Sat, 21 Feb 2015 11:12:44 +0000

>>>>> Ivan Shmakov <[email-masked]> writes:
>>>>> Stefan Monnier <[email-masked]> writes:

 >>> + (warn "Face %S is a string; interning" face)

 >>> + (message "Face %S is a string; interning" face)

 >> Why `warn' in one and `message' in the other?

 > By the time we hit this in ‘face-attribute’, the point at which the
 > sub-setandard string-named face was introduced is presumably long
 > gone, so there’s no good reason to use ‘warn’.

	… Or, on a second thought, ‘message’, either.  Given that
	‘face-attribute’ has no idea of where the caller got this face
	from, there’s simply no way for it to provide any helpful
	message at this point.  (Say, “Face "bold", as found at position
	42 in #<buffer foo>, is a string; interning”.)

	Now, given that there’s a number of “internal” functions (such
	as ‘internal-lisp-face-p’, for instance) which accept string
	face names just fine, I wonder if it makes sense to just change
	‘internal-get-lisp-face-attribute’ accordingly?  An untested
	patch is hereby MIMEd.

[…]

-- 
FSF associate member #7257  np. Fear of the Dark — Iron Maiden B6A0 230E 334A
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3570,15 +3570,18 @@ the result will be absolute, otherwise it will be relative.  */)
 DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute,
        Sinternal_get_lisp_face_attribute,
        2, 3, 0,
-       doc: /* Return face attribute KEYWORD of face SYMBOL.
-If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid
+       doc: /* Return face attribute KEYWORD of face FACE.
+FACE should be a symbol or string.
+If FACE does not name a valid Lisp face or KEYWORD isn't a valid
 face attribute name, signal an error.
-If the optional argument FRAME is given, report on face SYMBOL in that
-frame.  If FRAME is t, report on the defaults for face SYMBOL (for new
+If the optional argument FRAME is given, report on face FACE in that
+frame.  If FRAME is t, report on the defaults for face FACE (for new
 frames).  If FRAME is omitted or nil, use the selected frame.  */)
-  (Lisp_Object symbol, Lisp_Object keyword, Lisp_Object frame)
+  (Lisp_Object face, Lisp_Object keyword, Lisp_Object frame)
 {
   struct frame *f = EQ (frame, Qt) ? NULL : decode_live_frame (frame);
+  Lisp_Object symbol = (STRINGP (face) ? intern (SSDATA (face))
+			: face);
   Lisp_Object lface = lface_from_face_name (f, symbol, true), value = Qnil;
 
   CHECK_SYMBOL (symbol);