emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode 06f1c68 389/486: Merge pull request #300 from mm


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 06f1c68 389/486: Merge pull request #300 from mmilenko/rust-looking-back-macro--backward-char--fix
Date: Sat, 7 Aug 2021 09:25:59 -0400 (EDT)

branch: elpa/rust-mode
commit 06f1c6816c6291a71d636f2fbb9fd67a5c8d28c4
Merge: 8cd18cc 497d476
Author: Felix S Klock II <pnkfelix@pnkfx.org>
Commit: GitHub <noreply@github.com>

    Merge pull request #300 from 
mmilenko/rust-looking-back-macro--backward-char--fix
    
    Avoid signaling "Beginning of buffer" in rust-looking-back-macro
---
 rust-mode-tests.el | 8 ++++++++
 rust-mode.el       | 5 +++--
 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]+\\)")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]