summaryrefslogtreecommitdiff
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-09-02 20:27:59 +0000
committerGregory Heytings <gregory@heytings.org>2022-09-02 22:30:25 +0200
commitd0a66f3e0e668d8c12c54436740c62f8e238a664 (patch)
tree7c30003131e8416b2c33154e2d62712c75de29eb /src/xfaces.c
parentc12838c73ef161850a081f9ccea6e375b7c2f93b (diff)
downloademacs-d0a66f3e0e668d8c12c54436740c62f8e238a664.tar.gz
emacs-d0a66f3e0e668d8c12c54436740c62f8e238a664.tar.bz2
emacs-d0a66f3e0e668d8c12c54436740c62f8e238a664.zip
Display a warning for some uses of nil in face attributes.
* src/xfaces.c (HANDLE_INVALID_NIL_VALUE): New macro, which displays a warning for invalid uses of nil as a face attribute value. (Finternal_set_lisp_face_attribute): Use the macro for the attributes :foreground, :distant-foreground and :background.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 70d5cbeb4c7..5e3a47d7f8b 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3052,6 +3052,15 @@ The value is TO. */)
}
+#define HANDLE_INVALID_NIL_VALUE(A,F) \
+ if (NILP (value)) \
+ { \
+ add_to_log ("Warning: setting attribute `%s' of face `%s': nil " \
+ "value is invalid, use `unspecified' instead.", A, F); \
+ /* Compatibility with 20.x. */ \
+ value = Qunspecified; \
+ }
+
DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute,
Sinternal_set_lisp_face_attribute, 3, 4, 0,
doc: /* Set attribute ATTR of FACE to VALUE.
@@ -3390,9 +3399,7 @@ FRAME 0 means change the face on all frames, and change the default
}
else if (EQ (attr, QCforeground))
{
- /* Compatibility with 20.x. */
- if (NILP (value))
- value = Qunspecified;
+ HANDLE_INVALID_NIL_VALUE (QCforeground, face);
if (!UNSPECIFIEDP (value)
&& !IGNORE_DEFFACE_P (value)
&& !RESET_P (value))
@@ -3409,9 +3416,7 @@ FRAME 0 means change the face on all frames, and change the default
}
else if (EQ (attr, QCdistant_foreground))
{
- /* Compatibility with 20.x. */
- if (NILP (value))
- value = Qunspecified;
+ HANDLE_INVALID_NIL_VALUE (QCdistant_foreground, face);
if (!UNSPECIFIEDP (value)
&& !IGNORE_DEFFACE_P (value)
&& !RESET_P (value))
@@ -3428,9 +3433,7 @@ FRAME 0 means change the face on all frames, and change the default
}
else if (EQ (attr, QCbackground))
{
- /* Compatibility with 20.x. */
- if (NILP (value))
- value = Qunspecified;
+ HANDLE_INVALID_NIL_VALUE (QCbackground, face);
if (!UNSPECIFIEDP (value)
&& !IGNORE_DEFFACE_P (value)
&& !RESET_P (value))