[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode bbb3792 473/486: Remove "-face" suffix from name
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode bbb3792 473/486: Remove "-face" suffix from names of faces |
Date: |
Sat, 7 Aug 2021 09:26:17 -0400 (EDT) |
branch: elpa/rust-mode
commit bbb37921c78a70429a37046ae48ce2b1a77b3944
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: brotzeit <brotzeitmacher@gmail.com>
Remove "-face" suffix from names of faces
As mentioned in (info "(emacs)Defining Faces") the name of a face
> should not end in "-face" (that would be redundant).
For historic reasons a few built-in faces actually do end with
"-face" and it so happens that our faces are closely related to
just those `font-lock' faces and that probably inspired our use
of the suffix. Even so, we should stop now.
---
rust-mode-tests.el | 100 ++++++++++++++++++++++++++---------------------------
rust-mode.el | 29 ++++++++++------
2 files changed, 69 insertions(+), 60 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index c0e88fa..56ed369 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1638,13 +1638,13 @@ this_is_not_a_string();)"
"Ensure question mark operator is highlighted."
(rust-test-font-lock
"?"
- '("?" rust-question-mark-face))
+ '("?" rust-question-mark))
(rust-test-font-lock
"foo\(\)?;"
- '("?" rust-question-mark-face))
+ '("?" rust-question-mark))
(rust-test-font-lock
"foo\(bar\(\)?\);"
- '("?" rust-question-mark-face))
+ '("?" rust-question-mark))
(rust-test-font-lock
"\"?\""
'("\"?\"" font-lock-string-face))
@@ -1664,7 +1664,7 @@ this_is_not_a_string();)"
(rust-test-font-lock
"foo\(\"?\"\)?;"
'("\"?\"" font-lock-string-face
- "?" rust-question-mark-face)))
+ "?" rust-question-mark)))
(ert-deftest rust-test-default-context-sensitive ()
(rust-test-font-lock
@@ -2250,165 +2250,165 @@ fn main() {
;; is ignored
(rust-test-font-lock
"print!(\"\"); { /* print!(\"\"); */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"print!(\"\"); */" font-lock-comment-face))
;; with newline directly following delimiter
(rust-test-font-lock
"print!(\n\"\"\n); { /* print!(\"\"); */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"print!(\"\"); */" font-lock-comment-face))
;; with empty println!()
(rust-test-font-lock
"println!(); { /* println!(); */ }"
- '("println!" rust-builtin-formatting-macro-face
+ '("println!" rust-builtin-formatting-macro
"/* " font-lock-comment-delimiter-face
"println!(); */" font-lock-comment-face))
;; other delimiters
(rust-test-font-lock
"print!{\"\"}; { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; other delimiters
(rust-test-font-lock
"print![\"\"]; { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; no interpolation
(rust-test-font-lock
"print!(\"abcd\"); { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"abcd\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; only interpolation
(rust-test-font-lock
"print!(\"{}\"); { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"" font-lock-string-face
- "{}" rust-string-interpolation-face
+ "{}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; text + interpolation
(rust-test-font-lock
"print!(\"abcd {}\", foo); { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{}" rust-string-interpolation-face
+ "{}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; text + interpolation with specification
(rust-test-font-lock
"print!(\"abcd {0}\", foo); { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; text + interpolation with specification and escape
(rust-test-font-lock
"print!(\"abcd {0}}}\", foo); { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
"}}\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; multiple pairs
(rust-test-font-lock
"print!(\"abcd {0} efgh {1}\", foo, bar); { /* no-op */ }"
- '("print!" rust-builtin-formatting-macro-face
+ '("print!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; println
(rust-test-font-lock
"println!(\"abcd {0} efgh {1}\", foo, bar); { /* no-op */ }"
- '("println!" rust-builtin-formatting-macro-face
+ '("println!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; eprint
(rust-test-font-lock
"eprint!(\"abcd {0} efgh {1}\", foo, bar); { /* no-op */ }"
- '("eprint!" rust-builtin-formatting-macro-face
+ '("eprint!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; eprintln
(rust-test-font-lock
"eprintln!(\"abcd {0} efgh {1}\", foo, bar); { /* no-op */ }"
- '("eprintln!" rust-builtin-formatting-macro-face
+ '("eprintln!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; format
(rust-test-font-lock
"format!(\"abcd {0} efgh {1}\", foo, bar); { /* no-op */ }"
- '("format!" rust-builtin-formatting-macro-face
+ '("format!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; print + raw string
(rust-test-font-lock
"format!(r\"abcd {0} efgh {1}\", foo, bar); { /* no-op */ }"
- '("format!" rust-builtin-formatting-macro-face
+ '("format!" rust-builtin-formatting-macro
"r\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; print + raw string with hash
(rust-test-font-lock
"format!(r#\"abcd {0} efgh {1}\"#, foo, bar); { /* no-op */ }"
- '("format!" rust-builtin-formatting-macro-face
+ '("format!" rust-builtin-formatting-macro
"r#\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"#" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
;; print + raw string with two hashes
(rust-test-font-lock
"format!(r##\"abcd {0} efgh {1}\"##, foo, bar); { /* no-op */ }"
- '("format!" rust-builtin-formatting-macro-face
+ '("format!" rust-builtin-formatting-macro
"r##\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
" efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"##" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face)))
@@ -2416,29 +2416,29 @@ fn main() {
(ert-deftest rust-write-macro-font-lock ()
(rust-test-font-lock
"write!(f, \"abcd {0}}} efgh {1}\", foo, bar); { /* no-op */ }"
- '("write!" rust-builtin-formatting-macro-face
+ '("write!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
"}} efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
(rust-test-font-lock
"writeln!(f, \"abcd {0}}} efgh {1}\", foo, bar); { /* no-op */ }"
- '("writeln!" rust-builtin-formatting-macro-face
+ '("writeln!" rust-builtin-formatting-macro
"\"abcd " font-lock-string-face
- "{0}" rust-string-interpolation-face
+ "{0}" rust-string-interpolation
"}} efgh " font-lock-string-face
- "{1}" rust-string-interpolation-face
+ "{1}" rust-string-interpolation
"\"" font-lock-string-face
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face))
(rust-test-font-lock
"println!(\"123\"); eprintln!(\"123\"); cprintln!(\"123\");"
- '("println!" rust-builtin-formatting-macro-face
+ '("println!" rust-builtin-formatting-macro
"\"123\"" font-lock-string-face
- "eprintln!" rust-builtin-formatting-macro-face
+ "eprintln!" rust-builtin-formatting-macro
"\"123\"" font-lock-string-face
"cprintln!" font-lock-preprocessor-face
"\"123\"" font-lock-string-face)))
diff --git a/rust-mode.el b/rust-mode.el
index e842b8e..9be46d2 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -117,22 +117,31 @@ to the function arguments. When nil, `->' will be
indented one level."
;;; Faces
-(defface rust-unsafe-face
+(define-obsolete-face-alias 'rust-unsafe-face
+ 'rust-unsafe "0.6.0")
+(define-obsolete-face-alias 'rust-question-mark-face
+ 'rust-question-mark "0.6.0")
+(define-obsolete-face-alias 'rust-builtin-formatting-macro-face
+ 'rust-builtin-formatting-macro "0.6.0")
+(define-obsolete-face-alias 'rust-string-interpolation-face
+ 'rust-string-interpolation "0.6.0")
+
+(defface rust-unsafe
'((t :inherit font-lock-warning-face))
"Face for the `unsafe' keyword."
:group 'rust-mode)
-(defface rust-question-mark-face
+(defface rust-question-mark
'((t :weight bold :inherit font-lock-builtin-face))
"Face for the question mark operator."
:group 'rust-mode)
-(defface rust-builtin-formatting-macro-face
+(defface rust-builtin-formatting-macro
'((t :inherit font-lock-builtin-face))
"Face for builtin formatting macros (print! &c.)."
:group 'rust-mode)
-(defface rust-string-interpolation-face
+(defface rust-string-interpolation
'((t :slant italic :inherit font-lock-string-face))
"Face for interpolating braces in builtin formatting macro strings."
:group 'rust-mode)
@@ -401,7 +410,7 @@ Does not match type annotations of the form \"foo::<\"."
(,(regexp-opt rust-special-types 'symbols) . font-lock-type-face)
;; The unsafe keyword
- ("\\_<unsafe\\_>" . 'rust-unsafe-face)
+ ("\\_<unsafe\\_>" . 'rust-unsafe)
;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
(,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))
@@ -413,22 +422,22 @@ Does not match type annotations of the form \"foo::<\"."
"!"))
rust-formatting-macro-opening-re
"\\(?:" rust-start-of-string-re "\\)?")
- (1 'rust-builtin-formatting-macro-face)
+ (1 'rust-builtin-formatting-macro)
(rust-string-interpolation-matcher
(rust-end-of-string)
nil
- (0 'rust-string-interpolation-face t nil)))
+ (0 'rust-string-interpolation t nil)))
;; write! macro
(,(concat (rust-re-grab (concat (rust-re-word "write\\(ln\\)?") "!"))
rust-formatting-macro-opening-re
"[[:space:]]*[^\"]+,[[:space:]]*"
rust-start-of-string-re)
- (1 'rust-builtin-formatting-macro-face)
+ (1 'rust-builtin-formatting-macro)
(rust-string-interpolation-matcher
(rust-end-of-string)
nil
- (0 'rust-string-interpolation-face t nil)))
+ (0 'rust-string-interpolation t nil)))
;; Syntax extension invocations like `foo!`, highlight including the !
(,(concat (rust-re-grab (concat rust-re-ident "!")) "[({[:space:][]")
@@ -457,7 +466,7 @@ Does not match type annotations of the form \"foo::<\"."
(,(concat "'" (rust-re-grab rust-re-ident) "[^']") 1
font-lock-variable-name-face)
;; Question mark operator
- ("\\?" . 'rust-question-mark-face)
+ ("\\?" . 'rust-question-mark)
)
;; Ensure we highlight `Foo` in `struct Foo` as a type.
- [nongnu] elpa/rust-mode 41642f0 481/486: rust-end-of-string: Move definition, (continued)
- [nongnu] elpa/rust-mode 41642f0 481/486: rust-end-of-string: Move definition, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d548425 483/486: Create rust-playpen.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode eb5270b 437/486: rust-before-save-hook: log errors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 2df6cf7 439/486: Don't fail on re-search-forward. (#359), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ca415e9 470/486: Add rust-check function, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e327658 274/486: Merge pull request #178 from ryuslash/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7e2533f 415/486: Fix rustc-compilation-regexps: match error messages with dashes. (#331), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9107989 424/486: review, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d0f3f45 431/486: imenu: fn items: match async/const and all pub variants. (#346), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7afad7b 464/486: rearrange II: Regexp variables and functions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bbb3792 473/486: Remove "-face" suffix from names of faces,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 3eb6d2f 485/486: Create rust-utils.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b81c723 467/486: Various cosmetic changes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1f8a763 446/486: Fix typos, ELPA Syncer, 2021/08/07