Further improve blink-matching-paren-highlight-offscreen

* lisp/simple.el (blink-matching-paren-offscreen): Inherit from
show-paren-match face.
(blink-paren-open-paren-line-string): Add blink-matching-paren-offscreen
face properties to opening paren instead of replacing original
fontification.
* lisp/paren.el (show-paren-context-when-offscreen): Mention
blink-matching-paren-highlight-offscreen in docstring.
This commit is contained in:
Tassilo Horn
2026-03-17 06:13:54 +01:00
parent f8696367bc
commit fdfe617e73
2 changed files with 11 additions and 17 deletions

View File

@@ -103,7 +103,10 @@ If set to the symbol `child-frame', the context is shown in a
child frame at the top-left of the window. You might want to
customize the `child-frame-border' face (especially the
background color) to give the child frame a distinguished border.
On non-graphical frames, the context is shown in the echo area."
On non-graphical frames, the context is shown in the echo area.
Note that `blink-matching-paren-highlight-offscreen' can have an
influence on the fontification of the opening offscreen paren."
:type '(choice (const :tag "Off" nil)
(const :tag "In echo area" t)
(const :tag "In overlay" overlay)

View File

@@ -9528,7 +9528,7 @@ This highlighting uses the `blink-matching-paren-offscreen' face."
:group 'paren-blinking)
(defface blink-matching-paren-offscreen
'((t :foreground "green"))
'((t :inherit show-paren-match))
"Face for showing in the echo area matched open paren that is off-screen.
This face is used only when `blink-matching-paren-highlight-offscreen'
is non-nil."
@@ -9689,21 +9689,12 @@ face if `blink-matching-paren-highlight-offscreen' is non-nil."
(lambda (region)
(buffer-substring (car region) (cdr region)))
regions
"..."))
(openparen-next-char-idx (1+ openparen-idx)))
(concat
(substring line-string
0 openparen-idx)
(let ((matched-offscreen-openparen
(substring line-string
openparen-idx openparen-next-char-idx)))
(if blink-matching-paren-highlight-offscreen
(propertize
(substring-no-properties matched-offscreen-openparen)
'face 'blink-matching-paren-offscreen)
matched-offscreen-openparen))
(substring line-string
openparen-next-char-idx))))))
"...")))
(when blink-matching-paren-highlight-offscreen
(add-face-text-property openparen-idx (1+ openparen-idx)
'blink-matching-paren-offscreen
nil line-string))
line-string))))
(defvar blink-paren-function 'blink-matching-open
"Function called, if non-nil, whenever a close parenthesis is inserted.