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

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

[nongnu] elpa/rainbow-delimiters b9991fb222 047/188: Handle unescaped pa


From: ELPA Syncer
Subject: [nongnu] elpa/rainbow-delimiters b9991fb222 047/188: Handle unescaped parentheses characters, e.g. ?(
Date: Sat, 1 Jan 2022 00:58:51 -0500 (EST)

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

    Handle unescaped parentheses characters, e.g. ?(
    
    It's deprecated, but people seem to still use them instead of recommended 
?\(
    
    Fixes #11 and #15.
---
 rainbow-delimiters.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 0201f8b113..c1514ee1ef 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -415,11 +415,11 @@ Sets text properties:
     ))
 
 (defun rainbow-delimiters-escaped-char-predicate-emacs-lisp (loc)
-  (and (eq (char-before loc) ?\\)  ; escaped char, e.g. ?\) - not counted
-       (and (not (eq (char-before (1- loc)) ?\\)) ; special-case: ignore ?\\
-            (eq (char-before (1- loc)) ?\?))))
-;; NOTE: standard char read syntax '?)' is not tested for because emacs manual
-;; states punctuation such as delimiters should _always_ use escaped '?\)' 
form.
+  (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)) ?\?))))
+      (and (eq (char-before loc) ?\\) ; escaped char, e.g. ?\) - not counted
+           (eq (char-before (1- loc)) ?\?))))
 
 (defun rainbow-delimiters-escaped-char-predicate-lisp (loc)
   (eq (char-before loc) ?\\))



reply via email to

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