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

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

[nongnu] elpa/rainbow-delimiters 402a9e8e04 152/188: Treat the ? as a qu


From: ELPA Syncer
Subject: [nongnu] elpa/rainbow-delimiters 402a9e8e04 152/188: Treat the ? as a quote character only when it starts a symbol.
Date: Sat, 1 Jan 2022 00:59:00 -0500 (EST)

branch: elpa/rainbow-delimiters
commit 402a9e8e04208945bde5dac88894e764398b3b24
Author: Fanael Linithien <fanael4@gmail.com>
Commit: Fanael Linithien <fanael4@gmail.com>

    Treat the ? as a quote character only when it starts a symbol.
    
    This is so we're not confused by (foo?), which is a valid function call.
    Fixes 'doesnt-highlight-escaped-delimiters' test failure.
---
 rainbow-delimiters.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 7bb17a2134..a81953eca9 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -201,7 +201,13 @@ The delimiter is not highlighted if it's a blacklisted 
delimiter."
   "Non-nil iff the character at LOC is escaped as per Emacs Lisp rules."
   (or (and (eq (char-before loc) ?\?) ; e.g. ?) - deprecated, but people use it
            (not (and (eq (char-before (1- loc)) ?\\) ; special case: ignore ?\?
-                     (eq (char-before (- loc 2)) ?\?))))
+                     (eq (char-before (- loc 2)) ?\?)))
+           ;; Treat the ? as a quote character only when it starts a symbol, so
+           ;; we're not confused by (foo?), which is a valid function call.
+           (let ((inhibit-changing-match-data t))
+             (save-excursion
+               (goto-char (1- loc))
+               (looking-at "\\_<"))))
       (and (eq (char-before loc) ?\\) ; escaped char, e.g. ?\) - not counted
            (eq (char-before (1- loc)) ?\?))))
 



reply via email to

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