new site
I have a new, non-tech related, blog. It collates stock market predictions from the news and the Web and checks if they came out true or not. If that interests you check it out at The Stock Market Scoreboard.
format
in Emacs Lisp. It is inspired by Common Lisp, and is therefore ugly.
(defun yformat (out string &rest objects)
(cond ((not out)
(apply 'format string objects))
((integerp out)
(goto-char out)
(insert (apply 'format string objects)))
((bufferp out)
(with-current-buffer out
(insert (apply 'format string objects))))
(out
(insert (apply 'format string objects)))))
$ adb logcat > logcat
from within. Then I disconnect from the screen session and am left with the emulator and GNU/Emacs. The following code snipplet adds some font-locking and auto-revert-tail-mode to the Emacs buffer visiting the logcat
file:
(add-to-list 'auto-mode-alist '("logcat" . android-logcat-mode))
...
(defvar android-logcat-font-lock-keywords
(list '("^V/.*$"
. font-lock-comment-face)
'("^W/.*$"
. font-lock-constant-face)
'("^E/.*$"
. font-lock-warning-face)))
(define-derived-mode android-logcat-mode text-mode "Android-Logcat"
"Major mode for looking at Android logcat output."
(interactive)
(auto-revert-tail-mode)
(goto-char (point-max))
(set (make-local-variable 'font-lock-defaults)
'(android-logcat-font-lock-keywords))
(font-lock-mode 1))