[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 09efc45 320/486: Merge pull request #219 from Aa
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 09efc45 320/486: Merge pull request #219 from Aankhen/highlight-question-mark |
Date: |
Sat, 7 Aug 2021 09:25:44 -0400 (EDT) |
branch: elpa/rust-mode
commit 09efc45dee786cb220c233426ddd82b26ad950eb
Merge: 0985f5f 34cc528
Author: Tom Tromey <tom@tromey.com>
Commit: GitHub <noreply@github.com>
Merge pull request #219 from Aankhen/highlight-question-mark
Highlight question mark operator using new `rust-question-mark-face'
---
rust-mode-tests.el | 32 ++++++++++++++++++++++++++++++++
rust-mode.el | 8 ++++++++
2 files changed, 40 insertions(+)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index b1d51c9..614340c 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1510,6 +1510,38 @@ this_is_not_a_string();)"
;; Only the i32 should have been highlighted.
'("i32" font-lock-type-face)))
+(ert-deftest font-lock-question-mark ()
+ "Ensure question mark operator is highlighted."
+ (rust-test-font-lock
+ "?"
+ '("?" rust-question-mark-face))
+ (rust-test-font-lock
+ "foo\(\)?;"
+ '("?" rust-question-mark-face))
+ (rust-test-font-lock
+ "foo\(bar\(\)?\);"
+ '("?" rust-question-mark-face))
+ (rust-test-font-lock
+ "\"?\""
+ '("\"?\"" font-lock-string-face))
+ (rust-test-font-lock
+ "foo\(\"?\"\);"
+ '("\"?\"" font-lock-string-face))
+ (rust-test-font-lock
+ "// ?"
+ '("// " font-lock-comment-delimiter-face
+ "?" font-lock-comment-face))
+ (rust-test-font-lock
+ "/// ?"
+ '("/// ?" font-lock-doc-face))
+ (rust-test-font-lock
+ "foo\(\"?\"\);"
+ '("\"?\"" font-lock-string-face))
+ (rust-test-font-lock
+ "foo\(\"?\"\)?;"
+ '("\"?\"" font-lock-string-face
+ "?" rust-question-mark-face)))
+
(ert-deftest rust-test-default-context-sensitive ()
(rust-test-font-lock
"let default = 7; impl foo { default fn f() { } }"
diff --git a/rust-mode.el b/rust-mode.el
index 2c58545..eac246f 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -165,6 +165,11 @@ function or trait. When nil, where will be aligned with
fn or trait."
"Face for the `unsafe' keyword."
:group 'rust-mode)
+(defface rust-question-mark-face
+ '((t :weight bold :inherit font-lock-builtin-face))
+ "Face for the question mark operator."
+ :group 'rust-mode)
+
(defun rust-paren-level () (nth 0 (syntax-ppss)))
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))
(defun rust-rewind-past-str-cmnt () (goto-char (nth 8 (syntax-ppss))))
@@ -603,6 +608,9 @@ the desired identifiers), but does not match type
annotations \"foo::<\"."
;; CamelCase Means Type Or Constructor
(,rust-re-type-or-constructor 1 font-lock-type-face)
+
+ ;; Question mark operator
+ ("\\?" . 'rust-question-mark-face)
)
;; Item definitions
- [nongnu] elpa/rust-mode ce7a27f 381/486: Add compilation mode warning face, (continued)
- [nongnu] elpa/rust-mode ce7a27f 381/486: Add compilation mode warning face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c1059d6 387/486: Added angle bracket tests, some of which fail without the fix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 06f1c68 389/486: Merge pull request #300 from mmilenko/rust-looking-back-macro--backward-char--fix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 48290d3 399/486: Merge pull request #318 from kraai/patch-1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f6ebcbd 400/486: Update travis scripts to use EVM, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 077cba7 402/486: Add local docker based tests runner, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1d42d69 416/486: Speed up line indentation inside strings (#313), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4a7a860 480/486: Properly markup two additional section headings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a789a25 266/486: Fix #168: use while in rust-rewind-irrelevant, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 936a187 276/486: handle indirect buffers and multiple windows in rust-format-buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 09efc45 320/486: Merge pull request #219 from Aankhen/highlight-question-mark,
ELPA Syncer <=
- [nongnu] elpa/rust-mode b10ad41 326/486: Merge pull request #220 from Aankhen/highlight-string-interpolation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d71fe94 307/486: restore points when an error occurs too, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1b3db88 422/486: Add a function wrap and unwrap with the dbg! macro., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8733792 448/486: Drop Emacs-24, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9eb2c63 460/486: Fix README internal link (#389), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 13c4335 462/486: Improve doc-strings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c23453d 463/486: rearrange I: Move options and faces to beginning of file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 649f492 484/486: Create rust-cargo.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 198c777 386/486: Replaced font-lock-fontify-buffer with font-lock-ensure, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a871d10 390/486: Merge pull request #298 from jjwest/master, ELPA Syncer, 2021/08/07