branch: elpa/rainbow-delimiters
commit 402a9e8e04208945bde5dac88894e764398b3b24
Author: Fanael Linithien <[email protected]>
Commit: Fanael Linithien <[email protected]>

    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