mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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
This commit is contained in:
parent
99b3250d04
commit
fb1a489757
2 changed files with 22 additions and 11 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue