summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2024-09-28 22:04:19 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2024-09-29 12:19:19 +0200
commit8d0c8076c3f2c27bd8ff0dbc72d046c64e1dde44 (patch)
treeb4e89553c1c2605cdc761a010f07fd1338dd118e
parentdfdeee839ac5475a7788707228dcbc998426ad7f (diff)
Warn about :reverse-video in defface
This attribute keyword has been non-working in defface for 14 years, thus warning about it is both safe and decent. * lisp/emacs-lisp/bytecomp.el (bytecomp--check-cus-face-spec): Warn and suggest :inverse-video to be used instead. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-defface-spec): Add a test case. * etc/NEWS: Notify the user.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/emacs-lisp/bytecomp.el7
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el4
3 files changed, 13 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 498e8f2db2d..876fd137a4d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -470,6 +470,10 @@ All the characters that belong to the 'symbol' script (according to
* Lisp Changes in Emacs 31.1
+---
+** The face attribute ':reverse-video' is obsolete.
+Use ':inverse-video' instead.
+
+++
** Support interactive D-Bus authorization.
A new ':authorizable t' parameter has been added to 'dbus-call-method'
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 1c84fe0804b..47df26f01d6 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -5396,15 +5396,18 @@ FORM is used to provide location, `bytecomp--cus-function' and
:underline :overline :strike-through :box
:inverse-video :stipple :font
;; FIXME: obsolete keywords, warn about them too?
- ;; `:reverse-video' is very rare.
:bold ; :bold t = :weight bold
:italic ; :italic t = :slant italic
- :reverse-video ; alias for :inverse-video
))
(when (eq (car-safe val) 'quote)
(bytecomp--cus-warn
(list val atts sp spec)
"Value for face attribute `%s' should not be quoted" attr)))
+ ((eq attr :reverse-video)
+ (bytecomp--cus-warn
+ (list atts sp spec)
+ (concat "Face attribute `:reverse-video' is obsolete;"
+ " use `:inverse-video' instead")))
(t
(bytecomp--cus-warn
(list atts sp spec)
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index cce6b1221fc..39c3732581a 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -2001,6 +2001,10 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
(rx "`:inverse' is not a valid face attribute keyword")
(df '((t (:background "blue" :inverse t))))) ; old attr list syntax
(bytecomp--with-warning-test
+ (rx "Face attribute `:reverse-video' is obsolete;"
+ " use `:inverse-video' instead")
+ (df '((t :background "red" :reverse-video t))))
+ (bytecomp--with-warning-test
(rx "Value for face attribute `:inherit' should not be quoted")
(df '((t :inherit 'other))))
(bytecomp--with-warning-test