Subject: 29.0.50; [PATCH] Show offscreen context with properties

From: Arash Esbati <[email-masked]>
Date: Fri, 05 Nov 2021 10:40:47 +0100

Hi all,

paren.el now can show the context in minibuffer when
`show-paren-context-when-offscreen' is non-nil (introduced in this
change 9f505c476e).  Is it possible to extend this that text properties
are not stripped?  I'm thinking about something like this:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/paren.el b/lisp/paren.el
index 7e7cf6c262..d0330f2f6a 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -96,6 +96,14 @@ show-paren-context-when-offscreen
   :type 'boolean
   :version "29.1")

+(defcustom show-paren-context-when-offscreen-with-properties nil
+  "If non-nil, show the offscreen context in the echo area with properties.
+It is complementary to `show-paren-context-when-offscreen' and is
+taken into account when `show-paren-context-when-offscreen' is
+non-nil."
+  :type 'boolean
+  :version "29.1")
+
 (defvar show-paren--idle-timer nil)
 (defvar show-paren--overlay
   (let ((ol (make-overlay (point) (point) nil t))) (delete-overlay ol) ol)
@@ -332,7 +340,9 @@ show-paren-function
                       (message-log-max nil))
                   (minibuffer-message
                    "Matches %s"
-                   (substring-no-properties open-paren-line-string)))))
+                   (if show-paren-context-when-offscreen-with-properties
+                       open-paren-line-string
+                     (substring-no-properties open-paren-line-string))))))
           ;; Always set the overlay face, since it varies.
           (overlay-put show-paren--overlay 'priority show-paren-priority)
           (overlay-put show-paren--overlay 'face face))))))
--8<---------------cut here---------------end--------------->8---

Any comments welcome.  I will prepare a proper format-patch (incl. update of
programs.texi) once this is accepted.

Best, Arash