Created
October 29, 2012 10:55
-
-
Save ivv-private/3972934 to your computer and use it in GitHub Desktop.
blog-emacs-java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'auto-complete-config) | |
(ac-config-default) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/auto-complete/ac-dict") | |
(add-to-list 'ac-modes 'jde-mode) | |
(setq ac-ignore-case 'smart) | |
(setq ac-use-menu-map t) | |
(define-key ac-menu-map "\C-n" 'ac-next) | |
(define-key ac-menu-map "\C-p" 'ac-previous) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; saving hooks | |
(add-hook 'before-save-hook | |
(lambda () | |
(jde-import-kill-extra-imports) | |
(jde-import-all) | |
(jde-import-organize)) | |
nil t) | |
(add-hook 'after-save-hook 'jde-compile nil t))) | |
;; recognize output | |
(require 'compile) | |
(setq compilation-error-regexp-alist | |
(list | |
;; works for maven 3.x | |
'("^\\(\\[ERROR\\] \\)?\\(/[^:]+\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\]" 2 3 4) | |
;; works for maven jde javac server | |
'("^\\(/[^:]+\\):\\([0-9]+\\):" 1 2) | |
;; surefire | |
'("^\\sw+(\\(\\sw+\\.\\)+\\(\\sw+\\)).+<<< \\(FAILURE\\|ERROR\\)!$"2) | |
)) | |
;; append compilation snippets | |
(let ((snippets-buf | |
(find-file-noselect | |
(concat user-emacs-directory "/etc/java-compile.org"))) | |
(setq compile-history nil) | |
(with-current-buffer | |
snippets-buf | |
(org-map-region | |
'(lambda nil | |
(add-to-list | |
'compile-history | |
(format | |
"#%s\\\n%s" | |
(nth 4 (org-heading-components)) | |
(mapconcat 'string (org-get-entry) "")))) | |
1 (buffer-end 1)) | |
(kill-buffer snippets-buf))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* ALL | |
P="dev,risk"; SKIP="true"; \ | |
mvn clean install -f ~/projects/h/vaadin-components/pom.xml -DskipTests=$SKIP && \ | |
mvn clean install -f ~/projects/h/hierarchies/pom.xml -DskipTests=$SKIP -P$P | |
* RUN | |
P="dev,risk"; SKIP="true"; \ | |
MAVEN_OPTS="$MAVEN_OPTS -Xrunjdwp:transport=dt_socket,address=40487,server=y,suspend=n"; \ | |
mvn -pl application/ jetty:run-exploded -f ~/projects/h/hierarchies/pom.xml \ | |
-P$P -Djetty.port=40480 | |
* CRUN | |
PL="core"; P="dev,risk"; SKIP="true"; \ | |
mvn clean install -f ~/projects/h/hierarchies/pom.xml -DskipTests=$SKIP -P$P -pl "${PL}" && \ | |
MAVEN_OPTS="$MAVEN_OPTS -Xrunjdwp:transport=dt_socket,address=40487,server=y,suspend=n"; \ | |
mvn -pl application/ jetty:run-exploded -f ~/projects/h/hierarchies/pom.xml \ | |
-P$P -Djetty.port=40480 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; load source paths | |
(add-hook | |
'jdb-mode-hook | |
(lambda () | |
(load-file | |
(concat | |
user-emacs-directory | |
(convert-standard-filename "var/jdb-directories.el"))))) | |
;; redefine class thru jdb | |
(gud-def | |
gud-redefine | |
(gud-call | |
(format | |
"redefine %%c %s/%s.class" | |
(file-truename jde-compile-option-directory) | |
(replace-regexp-in-string "\\." "/" (gud-format-command "%c" arg)))) | |
"\C-r" "Redefine class") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE_NAME=${HOME}/projects | |
EMACS_JDB_DIR=${HOME}/.emacs.d/var/jdb-directories.el | |
SEARCH_EXT="java groovy" | |
SEARCH_EXLUDE_PATH="examples test samples tests tmp vendors target" | |
TMP_LIST=/tmp/.jdb.list | |
# construct searching regexp | |
REGEXP_SEARCH=$( | |
echo -n ${BASE_NAME} | |
echo -n '.*\.\(' | |
echo -n ${SEARCH_EXT} | sed 's/\ /\\|/g' | |
echo -n '\)$' | |
) | |
REGEXP_EXCLUDE=$(echo ${SEARCH_EXLUDE_PATH} | sed 's/\ /\\|/g' ) | |
REGEXP_EXCLUDE="\/\(${REGEXP_EXCLUDE}\)\/" | |
# findup sources | |
find $BASE_NAME -follow \( -path \*/.svn -o -path \*/target \) -prune -type f -o \( -path \*/src/\* \) -iname '*.java' \ | |
| xargs -n1 -P0 awk '/^\t*package/ { sub(";",""); num=match(FILENAME, $2); print substr(FILENAME, 1, num - 2); exit}' \ | |
| sort | uniq | sed '/^$/ d; s/cygdrive\/c/c:/;' > ${TMP_LIST} | |
(awk 'BEGIN {print "use ."} {sub("/cygwin/c","c:/"); print $0 }' ${TMP_LIST} | tr '\n' ':' > ${HOME}/.jdbrc) & | |
(awk 'BEGIN {print "(setq gud-jdb-sourcepath (quote ("} END {print ")))"} { print "\"" $0 "\"" } ' ${TMP_LIST} \ | |
| tr '\n' ' ' > ${EMACS_JDB_DIR}) & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'jde-help) | |
;; w3 fail to load local file, so skip this feature | |
(defmethod jde-jdhelper-show-url ((this jde-jdhelper) url) | |
(let ((doc-url (jde-url-name url))) | |
(message "Displaying %s from %s" | |
(oref url :class) | |
(oref (oref url :docset) :description)) | |
(jde-jdhelper-show-document this doc-url))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load "jde-autoload") | |
(setq jde-check-version-flag nil) | |
(setq jde-compile-option-directory | |
(concat user-emacs-directory "tmp")) | |
(require 'gud) | |
(defun java-my-minor () | |
(progn | |
(gtags-mode t) | |
(glasses-mode t) | |
(auto-complete-mode t) | |
(add-to-list 'ac-sources ac-source-gtags) | |
(local-set-key [f8] 'gud-next) | |
(local-set-key [f9] 'gud-cont) | |
(local-set-key (kbd "M-/") 'hippie-expand) | |
(local-set-key (kbd "C-c C-v .") 'jde-complete-minibuf) | |
(add-hook 'before-save-hook | |
(lambda () | |
(jde-import-kill-extra-imports) | |
(jde-import-all) | |
(jde-import-organize)) | |
nil t) | |
(add-hook 'after-save-hook 'jde-compile nil t))) | |
(add-hook 'jde-mode-hook 'java-my-minor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'log4j-mode) | |
(setq auto-mode-alist | |
(append '(("server.log" . log4j-mode) | |
("catalina.out" . log4j-mode) | |
("tomcat.log" . log4j-mode)) | |
auto-mode-alist)) | |
(add-hook | |
'log4j-mode-hook | |
(lambda () | |
(setq truncate-lines t) | |
(text-scale-set -1) | |
(toggle-read-only t) | |
(buffer-disable-undo) | |
(end-of-buffer))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ crontab -l | |
... | |
0 2 * * * find ~/projects/ -path \*/arch -prune -o \( -name pom.xml -print \) | \ | |
sed 's/pom.xml//' | sort | awk 'BEGIN {P="doh"} {if (index($0, P)==0){P=$0; print P "pom.xml"}}' | \ | |
xargs -P1 -n1 $M2_HOME/bin/mvn install jdee:jdee -DskipTests=true -q -f | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment