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

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

[nongnu] elpa/rainbow-delimiters bb38452706 155/188: Remove the Emacs Li


From: ELPA Syncer
Subject: [nongnu] elpa/rainbow-delimiters bb38452706 155/188: Remove the Emacs Lisp specific escaping test.
Date: Sat, 1 Jan 2022 00:59:01 -0500 (EST)

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

    Remove the Emacs Lisp specific escaping test.
    
    In fact, nuke the infrastructure altogether.
    
    Parens as characters without a backslash are nasty and they really should
    never be used:
     - This syntax is discouraged by the GNU Emacs Lisp Reference Manual.
     - They confuse many a minor mode, such as show-paren-mode.
     - The way we currently handle them partially solves the problem, but
       is a hack made of eldritch magic, implemented by gluing special cases
       together hoping they'll work...
     - ...but it doesn't really work, and it's pretty easy to get
       mishighlighted delimiters anyway.
     - They confuse the Emacs Lisp indentation engine. Really.
     - It's the major mode's job to set the syntax-table properties on
       individual characters.
    
    Because of these reasons, it's just easier to drop this misfeature
    and rely on people to start using ?\( instead.
    
    And because the whole point of
    rainbow-delimiters-escaped-char-predicate-list is to allow for this,
    nuke it too. It was never *really* a documented part of the API.
---
 rainbow-delimiters-test.el | 10 +++++-----
 rainbow-delimiters.el      | 27 +--------------------------
 2 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/rainbow-delimiters-test.el b/rainbow-delimiters-test.el
index 27c9ec56c7..9fb40a4879 100644
--- a/rainbow-delimiters-test.el
+++ b/rainbow-delimiters-test.el
@@ -194,17 +194,17 @@
 
 (ert-deftest doesnt-highlight-escaped-delimiters ()
   (with-temp-buffer-in-mode 'emacs-lisp-mode
-    (with-string (str "(bar ?\\( ?( (foo?))")
+    (with-string (str "(bar ?\\( (foo?))")
       (should (ert-equal-including-properties
                (buffer-string)
-               #("(bar ?\\( ?( (foo?))"
+               #("(bar ?\\( (foo?))"
                  0 1
                  (face (rainbow-delimiters-depth-1-face))
-                 12 13
+                 9 10
                  (face (rainbow-delimiters-depth-2-face))
-                 17 18
+                 14 15
                  (face (rainbow-delimiters-depth-2-face))
-                 18 19
+                 15 16
                  (face (rainbow-delimiters-depth-1-face))))))))
 
 (ert-deftest cycles-faces ()
diff --git a/rainbow-delimiters.el b/rainbow-delimiters.el
index 0320ce3dee..6be845f1e1 100644
--- a/rainbow-delimiters.el
+++ b/rainbow-delimiters.el
@@ -184,27 +184,6 @@ The delimiter is not highlighted if it's a blacklisted 
delimiter."
                         (rainbow-delimiters--depth-face depth)))))
       (font-lock-prepend-text-property loc (1+ loc) 'face delim-face))))
 
-(defvar rainbow-delimiters-escaped-char-predicate nil)
-(make-variable-buffer-local 'rainbow-delimiters-escaped-char-predicate)
-
-(defvar rainbow-delimiters-escaped-char-predicate-list
-  '((emacs-lisp-mode . rainbow-delimiters--escaped-char-predicate-emacs-lisp)
-    (lisp-interaction-mode . 
rainbow-delimiters--escaped-char-predicate-emacs-lisp)
-    (inferior-emacs-lisp-mode . 
rainbow-delimiters--escaped-char-predicate-emacs-lisp)
-    ))
-
-(defun rainbow-delimiters--escaped-char-predicate-emacs-lisp (loc)
-  "Non-nil iff the character at LOC is escaped as per Emacs Lisp rules."
-  (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)) ?\?)))
-       ;; 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 "\\_<")))))
-
 (defun rainbow-delimiters--char-ineligible-p (loc ppss delim-syntax-code)
   "Return t if char at LOC should not be highlighted.
 PPSS is the `parse-partial-sexp' state at LOC.
@@ -228,9 +207,7 @@ Returns t if char at loc meets one of the following 
conditions:
     ((/= 0 (logand #x20000 delim-syntax-code))
      (/= 0 (logand #x10000 (or (car (syntax-after (1- loc))) 0))))
     (t
-     nil))
-   (when rainbow-delimiters-escaped-char-predicate
-     (funcall rainbow-delimiters-escaped-char-predicate loc))))
+     nil))))
 
 (defconst rainbow-delimiters--delim-regex "\\s(\\|\\s)"
   "Regex matching all opening and closing delimiters the mode highlights.")
@@ -240,8 +217,6 @@ Returns t if char at loc meets one of the following 
conditions:
   "Highlight delimiters in region between point and END.
 
 Used by font-lock for dynamic highlighting."
-  (setq rainbow-delimiters-escaped-char-predicate
-        (cdr (assoc major-mode 
rainbow-delimiters-escaped-char-predicate-list)))
   (let* ((inhibit-point-motion-hooks t)
          ;; Point can be anywhere in buffer; determine the nesting depth at 
point.
          (last-ppss-pos (point))



reply via email to

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