From acab540eaf4f31f6877d2e216d71afc31053c18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Tue, 11 Oct 2022 06:32:03 +0200 Subject: journalctl display match font-lock --- elisp/journalctl.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/elisp/journalctl.el b/elisp/journalctl.el index c95c564..2d16240 100644 --- a/elisp/journalctl.el +++ b/elisp/journalctl.el @@ -27,7 +27,7 @@ "Keeps the optetes of the last call of journalctl.") (defcustom journalctl-error-keywords - '("Failed" "failed" "Error" "error" "critical" "couldn't" "Can't" "not" "Not" "unreachable") + '("Failed" "failed" "Error" "error" "critical" "couldn't" "Can't" "not" "Not" "unreachable" "FATAL") "Keywords that mark errors in journalctl output." :group 'journalctl :type 'string) @@ -78,7 +78,7 @@ :group 'journalctl) (defface journalctl-host-face - '((t :inherit font-lock-keyword-face)) + '((t :inherit font-lock-constant-face)) "Face for hosts in journalctl's output." :group 'journalctl) @@ -88,24 +88,26 @@ :group 'journalctl) (defvar journalctl-font-lock-keywords - (let* ( - ;; generate regex string for each category of keywords - (error-keywords-regexp (regexp-opt journalctl-error-keywords 'words)) - (warn-keywords-regexp (regexp-opt journalctl-warn-keywords 'words)) - (starting-keywords-regexp (regexp-opt journalctl-starting-keywords 'words)) - (finished-keywords-regexp (regexp-opt journalctl-finished-keywords 'words))) + (let ( + ;; generate regex string for each category of keywords + (error-keywords-regexp (regexp-opt journalctl-error-keywords 'words)) + (warn-keywords-regexp (regexp-opt journalctl-warn-keywords 'words)) + (starting-keywords-regexp (regexp-opt journalctl-starting-keywords 'words)) + (finished-keywords-regexp (regexp-opt journalctl-finished-keywords 'words))) `( (,warn-keywords-regexp . 'journalctl-warning-face) (,error-keywords-regexp . 'journalctl-error-face) (,starting-keywords-regexp . 'journalctl-starting-face) (,finished-keywords-regexp . 'journalctl-finished-face) - ("^\\([A-Z][a-z]+ [0-9]+ [0-9:]+\\)" . (1 'journalctl-timestamp-face)) - ("^\\([A-Z][a-z]+ [0-9]+ [0-9:]+\\) \\(\\(?:[[:alnum:]]\\|\\.\\)+\\)" . (2 'journalctl-host-face)) - ("^\\([A-Z][a-z]+ [0-9]+ [0-9:]+\\) \\(\\(?:[[:alnum:]]\\|\\.\\)+\\) \\(.*?:\\)" . (3 'journalctl-process-face)) + ("^\\([A-Z][a-z]+ [0-9]+ [0-9:]+\\) \\(\\(?:[[:alnum:]]\\|\\.\\)+\\) \\(.*?:\\)" + (1 'journalctl-timestamp-face) + (2 'journalctl-host-face) + (3 'journalctl-process-face)) ;; note: order above matters, because once colored, that part won't change. ;; in general, put longer words first ))) + (defcustom journalctl-hosts '("/ssh:alina|sudo::" "/ssh:nina|sudo::" -- cgit v1.2.3