;;; compile Java buffers (require 'compile) (defun jump-paren (arg) "If on a parenthesis-type char, jump to the matching on Argument ARG e." (interactive "p") (cond ((looking-at "\\s\(")(forward-list 1)(backward-char 1)) ((looking-at "\\s\)")(forward-char 1)(backward-list 1)))) ;; Automatically scroll compilation buffer (defadvice compile-internal (after compile-my-scroll activate compile) "Forces compile buffer to scroll. See around line 363 in compile.el" (let* ((ob (current-buffer))) (save-excursion (select-window (get-buffer-window ad-return-value)) (goto-char (point-max)) (select-window (get-buffer-window ob)) ))) ; parse funky Jikes error strings (defun jikes-setup () (set (make-local-variable 'compile-command) (cond ((file-exists-p "Makefile") ("make ")) ((file-exists-p "../Makefile") ("make -f ../Makefile")) (t (concat "jikes +D -bootclasspath /usr/local/java/jre/lib/rt.jar -classpath ." (if (getenv "CLASSPATH") (concat ":" (getenv "CLASSPATH"))) " " buffer-file-name)) ) ) ) (add-hook 'c-mode-hook (lambda () (unless (file-exists-p "Makefile") (set (make-local-variable 'compile-command) (let ((file (file-name-nondirectory buffer-file-name))) (concat "gcc -O2 -Wall -o " (file-name-sans-extension file) " " file)))))) (add-hook 'c++-mode-hook (lambda () (unless (file-exists-p "Makefile") (set (make-local-variable 'compile-command) (let ((file (file-name-nondirectory buffer-file-name))) (concat "g++ -O2 -Wall -o " (file-name-sans-extension file) " " file)))))) (add-hook 'java-mode-hook 'jikes-setup)