emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master fb1a489: A new face for show-paren in expression mo


From: Eli Zaretskii
Subject: [Emacs-diffs] master fb1a489: A new face for show-paren in expression mode
Date: Fri, 18 Aug 2017 05:07:12 -0400 (EDT)

branch: master
commit fb1a489757eb9237afbd2e39e453e4a5e06c9d86
Author: Felipe Ochoa <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    A new face for show-paren in expression mode
    
    * lisp/faces.el (show-paren-match-expression): Define the new face.
    * lisp/paren.el (show-paren-function): Apply the different face
    when in expression mode.  (Bug#28047)
    
    Copyright-paperwork-exempt: yes
---
 lisp/faces.el |  7 +++++++
 lisp/paren.el | 26 +++++++++++++++-----------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index 01d94d7..d9c90fd 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2854,6 +2854,13 @@ It is used for characters of no fonts too."
   "Face used for a matching paren."
   :group 'paren-showing-faces)
 
+(defface show-paren-match-expression
+  '((t :inherit show-paren-match))
+  "Face used for a matching paren when highlighting the whole expression.
+This face is used by `show-paren-mode'."
+  :group 'paren-showing-faces
+  :version "26.1")
+
 (defface show-paren-mismatch
   '((((class color)) (:foreground "white" :background "purple"))
     (t (:inverse-video t)))
diff --git a/lisp/paren.el b/lisp/paren.el
index a4d9200..5ccfa5f 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -247,13 +247,21 @@ It is the default value of `show-paren-data-function'."
              (there-beg (nth 2 data))
              (there-end (nth 3 data))
              (mismatch (nth 4 data))
+             (highlight-expression
+              (or (eq show-paren-style 'expression)
+                  (and there-beg
+                       (eq show-paren-style 'mixed)
+                       (let ((closest (if (< there-beg here-beg)
+                                          (1- there-end) (1+ there-beg))))
+                         (not (pos-visible-in-window-p closest))))))
              (face
-              (if mismatch
-                  (progn
-                    (if show-paren-ring-bell-on-mismatch
-                        (beep))
-                    'show-paren-mismatch)
-                'show-paren-match)))
+              (cond
+               (mismatch
+                (if show-paren-ring-bell-on-mismatch
+                    (beep))
+                'show-paren-mismatch)
+               (highlight-expression 'show-paren-match-expression)
+               (t 'show-paren-match))))
         ;;
         ;; If matching backwards, highlight the closeparen
         ;; before point as well as its matching open.
@@ -276,11 +284,7 @@ It is the default value of `show-paren-data-function'."
         ;; If it's an unmatched paren, turn off any such highlighting.
         (if (not there-beg)
             (delete-overlay show-paren--overlay)
-          (if (or (eq show-paren-style 'expression)
-                  (and (eq show-paren-style 'mixed)
-                       (let ((closest (if (< there-beg here-beg)
-                                          (1- there-end) (1+ there-beg))))
-                         (not (pos-visible-in-window-p closest)))))
+          (if highlight-expression
               (move-overlay show-paren--overlay
                            (if (< there-beg here-beg) here-end here-beg)
                             (if (< there-beg here-beg) there-beg there-end)



reply via email to

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