?

Log in

yrk

Previous Entry Share Next Entry
02:49 pm: android development with emacs; a code snipplet
I develop for Android using GNU/Emacs. Whenever I add some Emacs Lisp to help me along I try to remember and post it here. Typically I'll launch screen, then launch the Android emulator and $ 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))



Tags:
Powered by LiveJournal.com