Log in


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)
	  . font-lock-constant-face)
	  . font-lock-warning-face)))

(define-derived-mode android-logcat-mode text-mode "Android-Logcat"
  "Major mode for looking at Android logcat output."
  (goto-char (point-max))
  (set (make-local-variable 'font-lock-defaults)
  (font-lock-mode 1))

Powered by LiveJournal.com