# HG changeset patch # User Oleksandr Gavenko # Date 1381331114 -10800 # Node ID eed45b8a9e3a1780e72d7482274839d01fe15303 # Parent df229243950a943c9a2d96f8ba3b389573daef5e Highlight standard elements in log4* like log-files. diff -r df229243950a -r eed45b8a9e3a .emacs-my --- a/.emacs-my Wed Oct 09 16:44:42 2013 +0300 +++ b/.emacs-my Wed Oct 09 18:05:14 2013 +0300 @@ -1070,6 +1070,7 @@ (when (string-match "/var/log/\\|\\.log\\'" (buffer-file-name (current-buffer))) (auto-revert-tail-mode 1) + (log4-hi-mode 1) )) (add-hook 'find-file-hook 'my-auto-revert-tail-mode-hook) diff -r df229243950a -r eed45b8a9e3a log4-hi-mode.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/log4-hi-mode.el Wed Oct 09 18:05:14 2013 +0300 @@ -0,0 +1,23 @@ + +(require 'compile) + +(defvar log4-hi-keywords + '(("FATAL\\|ERROR" . compilation-error-face) + ("WARN" . compilation-warning-face) + ("INFO\\|DEBUG\\|TRACE" . compilation-info-face) )) + +;;;###autoload +(define-minor-mode log4-hi-mode + "Highlight standard elements in log4* like log-files." + nil " log4-hi" nil + :global nil + (message "%s" log4-hi-mode) + (catch 'exit + (when log4-hi-mode + (font-lock-mode 1) + (font-lock-add-keywords nil log4-hi-keywords) + (throw 'exit nil)) + (font-lock-remove-keywords nil log4-hi-keywords)) + (font-lock-fontify-buffer)) + +(provide 'log4-hi-mode)