Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add my stuff #1

Merged
merged 5 commits into from
May 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "edts-rte"]
path = edts-rte
url = git@github.com:liuhongchao/edts-rte.git
1 change: 1 addition & 0 deletions edts-rte
Submodule edts-rte added at 9e6b9d
19 changes: 18 additions & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
(require 'dominating-file)

;; Load up starter kit customizations

(require 'starter-kit-defuns)
(require 'starter-kit-bindings)
(require 'starter-kit-misc)
Expand All @@ -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)
Expand All @@ -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
18 changes: 18 additions & 0 deletions starter-kit-bindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<f4>") 'erlang-align-arrows)
(global-set-key (kbd "<f5>") 'revert-buffer)
(global-set-key (kbd "<f6>") 'erlang-indent-region)
(global-set-key (kbd "<f7>") 'insert_current_time_string)
(global-set-key (kbd "<f8>") 'find-grep-dired)
(global-set-key (kbd "<f9>") 'diff-mouse-goto-source)
(global-set-key (kbd "<f11>") 'toggle-term-char-line-mode)
(global-set-key (kbd "<f12>") '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
15 changes: 15 additions & 0 deletions starter-kit-defuns.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
74 changes: 74 additions & 0 deletions starter-kit-erlang.el
Original file line number Diff line number Diff line change
@@ -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)
45 changes: 45 additions & 0 deletions starter-kit-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions starter-kit-python.el
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down