diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..12e4426279 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "edts-rte"] + path = edts-rte + url = git@github.com:liuhongchao/edts-rte.git diff --git a/edts-rte b/edts-rte new file mode 160000 index 0000000000..9e6b9d8faf --- /dev/null +++ b/edts-rte @@ -0,0 +1 @@ +Subproject commit 9e6b9d8faf01f1d0006308a52be411a3c86325e9 diff --git a/init.el b/init.el index 78211e4afa..df9e097af4 100644 --- a/init.el +++ b/init.el @@ -58,7 +58,6 @@ (require 'dominating-file) ;; Load up starter kit customizations - (require 'starter-kit-defuns) (require 'starter-kit-bindings) (require 'starter-kit-misc) @@ -69,6 +68,7 @@ (require 'starter-kit-ruby) (require 'starter-kit-js) (require 'starter-kit-python) +(require 'starter-kit-erlang) (require 'starter-kit-completion) (regen-autoloads) @@ -85,4 +85,21 @@ (if (file-exists-p user-specific-dir) (mapc #'load (directory-files user-specific-dir nil ".*el$"))) +;; load my favorite theme when running X +(if (eq (window-system) 'x) + (load-theme 'tsdh-dark)) +(set-face-attribute 'default nil :height 110) + +;; my customized scratch buffer +(add-hook 'emacs-startup-hook 'my-startup-fun) +(defun my-startup-fun () + "customzied scratch buffer" + (let ((my-buffer (get-buffer "*scratch*"))) + (with-current-buffer my-buffer + (insert "Welcome back Hongchao!\n")) + (switch-to-buffer my-buffer))) + +;; start the emacs server +(server-start) + ;;; init.el ends here diff --git a/starter-kit-bindings.el b/starter-kit-bindings.el index bff46cb260..9709dcbc8d 100644 --- a/starter-kit-bindings.el +++ b/starter-kit-bindings.el @@ -91,5 +91,23 @@ (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) +;; f keys +(global-set-key (kbd "") 'erlang-align-arrows) +(global-set-key (kbd "") 'revert-buffer) +(global-set-key (kbd "") 'erlang-indent-region) +(global-set-key (kbd "") 'insert_current_time_string) +(global-set-key (kbd "") 'find-grep-dired) +(global-set-key (kbd "") 'diff-mouse-goto-source) +(global-set-key (kbd "") 'toggle-term-char-line-mode) +(global-set-key (kbd "") 'lookup_erldoc) +(global-set-key (kbd "\C-cl") 'org-store-link) +(global-set-key (kbd "\C-ca") 'org-agenda) +(global-set-key (kbd "M-g") 'goto-line) + +;; easily move around the buffer +(global-set-key [C-left] 'windmove-left) +(global-set-key [C-right] 'windmove-right) +(global-set-key [C-up] 'windmove-up) + (provide 'starter-kit-bindings) ;;; starter-kit-bindings.el ends here diff --git a/starter-kit-defuns.el b/starter-kit-defuns.el index c6b94ebb63..4b077bab0e 100644 --- a/starter-kit-defuns.el +++ b/starter-kit-defuns.el @@ -262,5 +262,20 @@ Symbols matching the text at point are put first in the completion list." (let ((name (file-relative-name file))) (vc-git-command buf 0 name "blame" "-w" rev))) +;; function to lookup erldoc +(defun lookup_erldoc() + "look up the word under cursor on the erldoc site" + (interactive) + (let (myStr url) + (setq myStr (thing-at-point 'symbol)) + (setq myStr (concat + "http://erldocs.com/R14B03/stdlib/lists.html?i=0&search=" + myStr)) + (message "querying %s" myStr) + (setq url myStr) + (browse-url url) + ) +) + (provide 'starter-kit-defuns) ;;; starter-kit-defuns.el ends here diff --git a/starter-kit-erlang.el b/starter-kit-erlang.el new file mode 100644 index 0000000000..2d2633c478 --- /dev/null +++ b/starter-kit-erlang.el @@ -0,0 +1,74 @@ +;; starter-kit-erlang.el - setup of erlang stuff + +;; erlang mode setup +(setq erlang-root-dir "/usr/lib/erlang") +(setq load-path (cons "/usr/lib/erlang/lib/tools-2.6.7/emacs/" load-path)) +(setq exec-path (cons "/usr/lib/erlang/bin" exec-path)) +(require 'erlang-start) + +(add-to-list 'load-path "~/.emacs.d/edts-rte/") +(require 'edts-start) + +(setq edts-projects + '(( ;; eduspider web + (name . "eduspider_web") + (root . "~/git/eduspider/nodes/eduspider_web/") + (lib_dirs . ("lib")) + (node-sname . "eduspider_web") + ) + ( ;; eduspider backend + (name . "eduspider_be") + (root . "~/git/eduspider/nodes/eduspider_be/") + (lib_dirs . ("lib")) + (node-sname . "eduspider_be") + ) + ( ;; rett + (name . "rett") + (root . "~/git/rett/") + (lib_dirs . ("lib")) + (node-sname . "rett") + ) + ( ;; efs + (name . "efs") + (root . "~/git/efs/nodes/efs_be") + (lib_dirs . ("lib" "deps")) + (node-sname . "efs_be") + ) + ( ;; rett_dev + (name . "rett") + (root . "~/git/rett_dev/") + (lib_dirs . ("lib")) + (node-sname . "rett") + ) + ( ;; edts + (name . "edts") + (root . "~/git/edts/") + (lib_dirs . ("lib")) + (node-sname . "edts") + ) + ( ;; edts-rte + (name . "edts-rte") + (root . "~/git/edts-rte/") + (lib_dirs . ("lib")) + (node-sname . "edts") + ) + )) + +;; Some Erlang customizations +(add-hook 'erlang-mode-hook + (lambda () + ;; when starting an Erlang shell in Emacs, default in the node name + (setq inferior-erlang-machine-options '("-sname" "emacs")) + ;; add Erlang functions to an imenu menu + (imenu-add-to-menubar "imenu"))) + +;; show the trailing whitespace +(defun 80_whitespace_and_show_trailing_ws() + (whitespace-mode t) + (setq whitespace-line-column 80) + (setq show-trailing-whitespace t)) + +(add-hook 'erlang-mode-hook '80_whitespace_and_show_trailing_ws) +(add-hook 'erlang-mode-hook 'linum-mode) + +(provide 'starter-kit-erlang) diff --git a/starter-kit-misc.el b/starter-kit-misc.el index 8711b98988..1781d1e272 100644 --- a/starter-kit-misc.el +++ b/starter-kit-misc.el @@ -173,5 +173,50 @@ (setq yas/prompt-functions '(yas/dropdown-prompt yas/ido-prompt yas/x-prompt)) (setq yas/wrap-around-region 'cua) +;; customized diff +(defun update-diff-colors () + "update the colors for diff faces" + (set-face-attribute 'diff-added nil + :foreground "white" :background "darkgreen") + (set-face-attribute 'diff-removed nil + :foreground "white" :background "darkred") + (set-face-attribute 'diff-context nil + :foreground "white" :background "black") + (set-face-attribute 'diff-changed nil + :foreground "white" :background "purple")) + +(eval-after-load "diff-mode" + '(update-diff-colors)) + +;; ido mode decoration +(setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) +(add-hook 'ido-minibuffer-setup-hook #'(lambda() (set (make-local-variable 'truncate-lines) nil))) +(add-hook 'ido-minibuffer-setup-hook #'(lambda() (enlarge-window 10))) + +;; underline style for current line highlight +(global-hl-line-mode t) +(setq hl-line-face 'underline) + +;; set the erc logs directory +(setq erc-log-channels-directory "~/.erc/logs/") +;; automatically save the log files +(setq erc-save-buffer-on-part t) + +;; to always insert 8 spaces when inserting a tab +(setq-default indent-tabs-mode nil) +(setq-default tab-width 8) +(setq indent-line-function 'insert-tab) + +;; set the encoding +(setq default-buffer-file-coding-system 'iso-8859-1) +(prefer-coding-system 'iso-8859-1) +(set-language-environment "Latin-1") +(setq file-buffer-coding 'iso-8859-1) + +;; white space +(whitespace-mode t) +(setq whitespace-line-column 80) +(setq show-trailing-whitespace t) + (provide 'starter-kit-misc) ;;; starter-kit-misc.el ends here diff --git a/starter-kit-python.el b/starter-kit-python.el index 32d40b6d5d..dc17dd2e52 100644 --- a/starter-kit-python.el +++ b/starter-kit-python.el @@ -66,6 +66,7 @@ ;; (flymake-add-checker flymake-newchecker-init) (require 'tramp) + (require 'tramp-cmds) ;; Utilities that increase legibility and reduce code duplication (defun current-file-remotep () "Tell if the file is remote"