summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rust-mode-tests.el8
-rw-r--r--rust-mode.el5
2 files changed, 11 insertions, 2 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index a5fea28..72a9e4e 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -2414,6 +2414,14 @@ fn main() {
"/* " font-lock-comment-delimiter-face
"no-op */" font-lock-comment-face)))
+(ert-deftest font-lock-fontify-angle-brackets ()
+ "Test that angle bracket fontify"
+ (should (equal (rust-test-fontify-string "<>") "<>"))
+ (should (equal (rust-test-fontify-string "<foo>") "<foo>"))
+ (should (equal (rust-test-fontify-string "<<>>") "<<>>"))
+ (should (equal (rust-test-fontify-string "<>>") "<>>"))
+ (should (equal (rust-test-fontify-string "<<>") "<<>")))
+
(ert-deftest rust-test-basic-paren-matching ()
(rust-test-matching-parens
"
diff --git a/rust-mode.el b/rust-mode.el
index c22cad8..3585f1d 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -80,7 +80,8 @@ Like `looking-back' but for fixed strings rather than regexps (so that it's not
(defun rust-looking-back-macro ()
"Non-nil if looking back at an ident followed by a !"
- (save-excursion (backward-char) (and (= ?! (char-after)) (rust-looking-back-ident))))
+ (if (> (- (point) (point-min)) 1)
+ (save-excursion (backward-char) (and (= ?! (char-after)) (rust-looking-back-ident)))))
;; Syntax definitions and helpers
(defvar rust-mode-syntax-table
@@ -1604,7 +1605,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
(when rust-format-on-save
(unless (executable-find rust-rustfmt-bin)
(error "Could not locate executable \"%s\"" rust-rustfmt-bin))))
-
+
(defvar rustc-compilation-regexps
(let ((file "\\([^\n]+\\)")
(start-line "\\([0-9]+\\)")