Added highlighting for special pattern to be less distracting. Two symbols are used as markers from each side to avoid most false positive matches.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Tue, 22 Sep 2020 12:55:29 +0300
changeset 1622 954b7c665c1a
parent 1621 95a7aa1e3e60
child 1623 66e7dd2d4cf4
Added highlighting for special pattern to be less distracting. Two symbols are used as markers from each side to avoid most false positive matches.
.emacs-my
log4-hi-mode.el
--- a/.emacs-my	Tue Sep 22 12:53:26 2020 +0300
+++ b/.emacs-my	Tue Sep 22 12:55:29 2020 +0300
@@ -894,6 +894,9 @@
 ;; 24.5; "(global-hi-lock-mode 1)" broke "C-x" key bindings inside "M-x term", especially for "emacs -nw" (Emacs inside Emacs).
 ; (global-hi-lock-mode -1)
 
+(when window-system
+  (set-face-attribute 'shadow nil :foreground "gray60")) ;; tan, gray70
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "highlight selected text")
 
--- a/log4-hi-mode.el	Tue Sep 22 12:53:26 2020 +0300
+++ b/log4-hi-mode.el	Tue Sep 22 12:55:29 2020 +0300
@@ -35,6 +35,11 @@
   "Face for time."
   :group 'log4-hi)
 
+(defface log4-hi-hide-face
+  '((t :inherit shadow))
+  "Face for extra text for hiding."
+  :group 'log4-hi)
+
 (defvar log4-hi-keywords
   '(("FATAL\\|ERROR" . 'log4-hi-error-face)
     ("WARN\\|SEVERE" . 'log4-hi-warn-face)
@@ -48,6 +53,10 @@
   '(("\\(:?[0-9]\\{2\\}?[0-9]\\{2\\}.[0-9]\\{2\\}.[0-9]\\{2\\}.\\|\\<\\)[0-9]?[0-9]:[0-9][0-9]:[0-9][0-9]\\>\\(:?\\.[0-9]\\{3\\}\\)?" . 'log4-hi-time-face))
   "Highlight regex for ISO date.")
 
+(defvar log4-hi-hide-regex
+  '(("\\[`.\\{3,100\\}`]" . 'log4-hi-hide-face))
+  "Highlight regex for extra text for hiding.")
+
 (defvar log4-hi-func t
   "Mark to use hilighting of function names in stacktraces. Currently only Java supported.")
 
@@ -64,11 +73,13 @@
       (font-lock-mode 1)
       (font-lock-add-keywords nil log4-hi-keywords)
       (font-lock-add-keywords nil log4-hi-time-keywords)
+      (font-lock-add-keywords nil log4-hi-hide-regex)
       (when log4-hi-func (font-lock-add-keywords nil log4-hi-func-keywords))
       (throw 'exit nil))
     (font-lock-remove-keywords nil log4-hi-keywords)
     (font-lock-remove-keywords nil log4-hi-time-keywords)
-    (font-lock-remove-keywords nil log4-hi-func-keywords))
+    (font-lock-remove-keywords nil log4-hi-func-keywords)
+    (font-lock-remove-keywords nil log4-hi-hide-regex))
   (font-lock-flush))
 
 (provide 'log4-hi-mode)