Skip to content

Instantly share code, notes, and snippets.

@sluchin
Last active December 17, 2015 08:39
Show Gist options
  • Save sluchin/5581612 to your computer and use it in GitHub Desktop.
Save sluchin/5581612 to your computer and use it in GitHub Desktop.
(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