diff options
| author | Mattias EngdegÄrd | 2024-09-28 22:04:19 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-09-29 12:19:19 +0200 |
| commit | 8d0c8076c3f2c27bd8ff0dbc72d046c64e1dde44 (patch) | |
| tree | b4e89553c1c2605cdc761a010f07fd1338dd118e | |
| parent | dfdeee839ac5475a7788707228dcbc998426ad7f (diff) | |
| download | emacs-8d0c8076c3f2c27bd8ff0dbc72d046c64e1dde44.tar.gz emacs-8d0c8076c3f2c27bd8ff0dbc72d046c64e1dde44.zip | |
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/NEWS | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 7 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 4 |
3 files changed, 13 insertions, 2 deletions
| @@ -470,6 +470,10 @@ All the characters that belong to the 'symbol' script (according to | |||
| 470 | 470 | ||
| 471 | * Lisp Changes in Emacs 31.1 | 471 | * Lisp Changes in Emacs 31.1 |
| 472 | 472 | ||
| 473 | --- | ||
| 474 | ** The face attribute ':reverse-video' is obsolete. | ||
| 475 | Use ':inverse-video' instead. | ||
| 476 | |||
| 473 | +++ | 477 | +++ |
| 474 | ** Support interactive D-Bus authorization. | 478 | ** Support interactive D-Bus authorization. |
| 475 | A new ':authorizable t' parameter has been added to 'dbus-call-method' | 479 | 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 | |||
| 5396 | :underline :overline :strike-through :box | 5396 | :underline :overline :strike-through :box |
| 5397 | :inverse-video :stipple :font | 5397 | :inverse-video :stipple :font |
| 5398 | ;; FIXME: obsolete keywords, warn about them too? | 5398 | ;; FIXME: obsolete keywords, warn about them too? |
| 5399 | ;; `:reverse-video' is very rare. | ||
| 5400 | :bold ; :bold t = :weight bold | 5399 | :bold ; :bold t = :weight bold |
| 5401 | :italic ; :italic t = :slant italic | 5400 | :italic ; :italic t = :slant italic |
| 5402 | :reverse-video ; alias for :inverse-video | ||
| 5403 | )) | 5401 | )) |
| 5404 | (when (eq (car-safe val) 'quote) | 5402 | (when (eq (car-safe val) 'quote) |
| 5405 | (bytecomp--cus-warn | 5403 | (bytecomp--cus-warn |
| 5406 | (list val atts sp spec) | 5404 | (list val atts sp spec) |
| 5407 | "Value for face attribute `%s' should not be quoted" attr))) | 5405 | "Value for face attribute `%s' should not be quoted" attr))) |
| 5406 | ((eq attr :reverse-video) | ||
| 5407 | (bytecomp--cus-warn | ||
| 5408 | (list atts sp spec) | ||
| 5409 | (concat "Face attribute `:reverse-video' is obsolete;" | ||
| 5410 | " use `:inverse-video' instead"))) | ||
| 5408 | (t | 5411 | (t |
| 5409 | (bytecomp--cus-warn | 5412 | (bytecomp--cus-warn |
| 5410 | (list atts sp spec) | 5413 | (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)) \ | |||
| 2001 | (rx "`:inverse' is not a valid face attribute keyword") | 2001 | (rx "`:inverse' is not a valid face attribute keyword") |
| 2002 | (df '((t (:background "blue" :inverse t))))) ; old attr list syntax | 2002 | (df '((t (:background "blue" :inverse t))))) ; old attr list syntax |
| 2003 | (bytecomp--with-warning-test | 2003 | (bytecomp--with-warning-test |
| 2004 | (rx "Face attribute `:reverse-video' is obsolete;" | ||
| 2005 | " use `:inverse-video' instead") | ||
| 2006 | (df '((t :background "red" :reverse-video t)))) | ||
| 2007 | (bytecomp--with-warning-test | ||
| 2004 | (rx "Value for face attribute `:inherit' should not be quoted") | 2008 | (rx "Value for face attribute `:inherit' should not be quoted") |
| 2005 | (df '((t :inherit 'other)))) | 2009 | (df '((t :inherit 'other)))) |
| 2006 | (bytecomp--with-warning-test | 2010 | (bytecomp--with-warning-test |