Last active
December 17, 2015 08:39
-
-
Save sluchin/5581612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar syslog-overlay-list nil) | |
(defun syslog-highlight () | |
" Highlight syslog." | |
(interactive) | |
(save-excursion | |
(goto-char (point-min)) | |
(let (bop eop string lst ol) | |
(while (not (eobp)) | |
(move-beginning-of-line nil) | |
(let ((space 0)) | |
(while (and (not (eolp)) (<= space 4)) | |
(search-forward " ") | |
(setq space (1+ space)))) | |
(setq bop (point)) | |
(search-forward " ") | |
(setq eop (1- (point))) | |
(unless (eolp) | |
(setq string (buffer-substring bop eop)) | |
(message "string: %s" string) | |
(when string | |
(unless (and lst (assoc-string string lst)) | |
(setq ol (make-overlay bop eop)) | |
(push ol syslog-overlay-list) | |
(overlay-put ol 'face '(background-color . "dark slate gray"))) | |
(add-to-list 'lst string))) | |
(forward-line 1))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment