my-log-mode.el
changeset 566 5efbc78b8c41
parent 565 a9f4afeefe2a
child 567 83b075682c97
--- a/my-log-mode.el	Wed Feb 09 00:44:43 2011 +0200
+++ b/my-log-mode.el	Wed Feb 09 01:03:42 2011 +0200
@@ -28,9 +28,11 @@
       (setq line (filter-buffer-substring start stop))
       (string-match fregex line)
       (setq fname (match-string 1 line))
-      (setq fline (string-to-int (match-string 2 line)))
+      (when fname
+        (setq fline (string-to-int (match-string 2 line)))
+        )
       )
-    (when (file-exists-p fname)
+    (when (and fname (file-exists-p fname))
       (find-file-other-window fname)
       (goto-line fline)
       )
@@ -45,9 +47,12 @@
 (define-generic-mode
   'my-log-mode
   nil
-  '("INT" "WM")
+  nil
   '(
-    ("^\\([^:]+\\):\\([[:digit:]]+\\):" (1 font-lock-constant-face) (2 font-lock-constant-face))
+    ("^\\([^:]+\\):\\([[:digit:]]+\\):[^
+]+$" (1 font-lock-keyword-face) (2 font-lock-type-face))
+    ("^\\([^:]\\{1,10\\}\\):[^
+]+$" (1 font-lock-function-name-face))
     )
   ;; '("\\.log$")
   nil
@@ -55,6 +60,8 @@
    (lambda nil
      ;; (setq buffer-read-only t)
      (use-local-map my-log-mode-map)
+     (modify-syntax-entry ?' ".")
+     (modify-syntax-entry ?\" ".")
      ))
   )