Skip to content

Instantly share code, notes, and snippets.

@puzza007
Created November 12, 2010 10:36
Show Gist options
  • Save puzza007/673962 to your computer and use it in GitHub Desktop.
Save puzza007/673962 to your computer and use it in GitHub Desktop.
My .emacs from work
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(case-fold-search t)
'(column-number-mode t)
'(current-language-environment "Latin-1")
'(default-input-method "latin-1-prefix")
'(global-font-lock-mode t nil (font-lock))
'(global-whitespace-mode t)
'(highlight-nonselected-windows t)
'(highlight-parentheses-mode t t)
'(indicate-buffer-boundaries (quote right))
'(indicate-empty-lines t)
'(inhibit-startup-screen t)
'(mouse-wheel-mode t nil (mwheel))
'(mouse-yank-at-point t)
'(safe-local-variable-values (quote ((erlang-indent-level . 2))))
'(save-place t nil (saveplace))
'(scroll-bar-mode (quote right))
'(show-paren-mode t)
'(show-paren-style (quote expression))
'(size-indication-mode t)
'(speedbar-frame-parameters (quote ((minibuffer) (width . 20) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (set-background-color "black"))))
'(tool-bar-mode nil nil (tool-bar))
'(transient-mark-mode t)
'(uniquify-buffer-name-style (quote forward) nil (uniquify))
'(visible-bell t)
'(wrangler-search-paths (quote ("/home/poliver/push/chat/chat_server"))))
; disable ctrl-z
(global-set-key [(control z)] nil)
; ctrl-tab buffer switching
(global-set-key [C-tab] 'other-window)
(global-set-key [M-s] 'isearch-forward-regexp)
(global-set-key (kbd "C-c d") 'duplicate-current-line-or-region)
(setq-default indent-tabs-mode t)
(setq-default tab-width 4)
;; C seems to ignore the setting above setting
(setq c-basic-offset 4)
;; show the filename in the title bar
(setq frame-title-format "%f")
;; stop the down-arrow-key from adding empty lines at the bottom of buffers
(setq next-line-add-newlines nil)
(setq column-number-mode t)
;; I hate to have to type yes
(fset 'yes-or-no-p 'y-or-n-p)
;; disable the menu bar
(menu-bar-mode -1)
; ediff buffers sid-by-side, like it should
(setq ediff-split-window-function 'split-window-horizontally)
; also, don't pop-up a seperate frame, just make a new window:
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
;; C-c <left> | <right> to prev | next window layout
(winner-mode 1)
; store backup files in ~/.backups-emacs/
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.backups-emacs")) ; don't litter my fs tree
delete-old-versions t
kept-new-versionhs 6
kept-old-versions 2
version-control t) ; use versioned backups
(defconst query-replace-highlight t)
(defconst search-highlight t)
; whitespace fun
(add-to-list 'load-path "/home/poliver/.emacs.d/")
;;http://www.emacswiki.org/emacs/WhiteSpace
(require 'whitespace)
(setq whitespace-style '(trailing tabs tab-mark lines-tail empty))
; Orbis code mandates the use of narrow to region
(put 'narrow-to-region 'disabled nil)
(require 'color-theme)
(color-theme-charcoal-black)
;(color-theme-hober)
;(color-theme-xemacs)
(defun toggle-selective-display ()
(interactive)
(set-selective-display (if selective-display nil 1)))
(global-set-key [f1] 'toggle-selective-display)
; Keyboard macros
(global-set-key [f6] 'delete-trailing-whitespace)
(global-set-key [f7] 'winner-undo)
(global-set-key [f8] 'winner-redo)
(global-set-key [f10] 'start-kbd-macro)
(global-set-key [f11] 'end-kbd-macro)
(global-set-key [f12] 'call-last-kbd-macro)
(defconst imenu-max-items 20)
(defconst imenu-sort-function 'imenu--sort-by-name)
(add-hook 'tcl-mode-hook 'imenu-add-menubar-index)
(add-hook 'sql-mode-hook 'imenu-add-menubar-index)
(global-set-key [mouse-3] 'imenu)
(require 'highlight-parentheses)
(defun turn-on-highlight-parentheses () (highlight-parentheses-mode 1))
(add-hook 'emacs-lisp-mode-hook 'turn-on-highlight-parentheses)
(add-hook 'lisp-mode-hook 'turn-on-highlight-parentheses)
(add-hook 'tcl-mode-hook 'turn-on-highlight-parentheses)
(add-hook 'java-mode-hook 'turn-on-highlight-parentheses)
(add-hook 'python-mode-hook 'turn-on-highlight-parentheses)
(add-hook 'c-mode-hook 'turn-on-highlight-parentheses)
(add-hook 'sql-mode-hook 'turn-on-highlight-parentheses)
;(add-hook 'js2-mode-hook 'turn-on-highlight-parentheses)
(setq tramp-syntax 'url)
(require 'tramp)
(setq tramp-default-method "ssh")
;; Since I like zapping to strings and regexps more than zapping to chars, I
;; bound them globally to M-z and M-Z, zap-to-char can be accessed with C-M-z.
(global-set-key (kbd "M-z") 'th-zap-to-string)
(global-set-key (kbd "M-Z") 'th-zap-to-regexp)
(global-set-key (kbd "C-M-z") 'zap-to-char)
(setq load-path (cons "/opt/otp/lib/erlang/lib/tools-2.6.6.1/emacs" load-path))
(setq erlang-root-dir "/opt/otp")
(setq exec-path (cons "/opt/otp/bin" exec-path))
(require 'erlang-start)
(add-hook 'erlang-mode-hook 'imenu-add-menubar-index)
; Erlang flymake. There is a god.
(require 'erlang-flymake)
;(add-to-list 'load-path "/usr/local/share/wrangler/elisp")
;(require 'wrangler)
; amazing Javascript mode
(add-to-list 'load-path "/space/home/poliver/src/js2-mode-read-only/build")
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(setq js2-use-font-lock-faces t)
(add-hook 'tcl-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1
font-lock-preprocessor-face t)))))
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode t)
(font-lock-add-keywords 'tcl-mode
'(
("\\<ipc_sem_create\\>" 0 font-lock-builtin-face)
("\\<ipc_sem_lock\\>" 0 font-lock-builtin-face)
("\\<ipc_sem_unlock\\>" 0 font-lock-builtin-face)
("\\<bintohex\\>" 0 font-lock-builtin-face)
("\\<bintob64\\>" 0 font-lock-builtin-face)
("\\<b64tobin\\>" 0 font-lock-builtin-face)
("\\<convert\\>" 0 font-lock-builtin-face)
("\\<urlencode\\>" 0 font-lock-builtin-face)
("\\<urldecode\\>" 0 font-lock-builtin-face)
("\\<compress\\>" 0 font-lock-builtin-face)
("\\<crypt\\>" 0 font-lock-builtin-face)
("\\<md5\\>" 0 font-lock-builtin-face)
("\\<sha1\\>" 0 font-lock-builtin-face)
("\\<des\\>" 0 font-lock-builtin-face)
("\\<blowfish\\>" 0 font-lock-builtin-face)
("\\<l_round\\>" 0 font-lock-builtin-face)
("\\<cvs_split\\>" 0 font-lock-builtin-face)
("\\<OT_MicroTime\\>" 0 font-lock-builtin-face)
("\\<OT_UniqueId\\>" 0 font-lock-builtin-face)
("\\<OT_DCashEnc\\>" 0 font-lock-builtin-face)
("\\<OT_CfgRead\\>" 0 font-lock-builtin-face)
("\\<OT_CfgSet\\>" 0 font-lock-builtin-face)
("\\<OT_CfgGet\\>" 0 font-lock-builtin-face)
("\\<OT_CfgGetTrue\\>" 0 font-lock-builtin-face)
("\\<OT_CfgGetNames\\>" 0 font-lock-builtin-face)
("\\<OT_LogOpen\\>" 0 font-lock-builtin-face)
("\\<OT_LogWrite\\>" 0 font-lock-builtin-face)
("\\<OT_LogClose\\>" 0 font-lock-builtin-face)
("\\<OT_LogLevel\\>" 0 font-lock-builtin-face)
("\\<OT_LogSetLevel\\>" 0 font-lock-builtin-face)
("\\<OT_LogGetLevel\\>" 0 font-lock-builtin-face)
("\\<OT_LogSetTiming\\>" 0 font-lock-builtin-face)
("\\<OT_LogGetPrefix\\>" 0 font-lock-builtin-face)
("\\<OT_LogSetPrefix\\>" 0 font-lock-builtin-face)
("\\<OT_LogGetAutoFlush\\>" 0 font-lock-builtin-face)
("\\<OT_LogGetLevelName\\>" 0 font-lock-builtin-face)
("\\<OT_LogSetLevelName\\>" 0 font-lock-builtin-face)
("\\<OT_LogDelLevelName\\>" 0 font-lock-builtin-face)
("\\<OT_LogGetLevelNames\\>" 0 font-lock-builtin-face)
("\\<OT_LogSetLevelUnknown\\>" 0 font-lock-builtin-face)
("\\<as[SG]etAct\\>" 0 font-lock-builtin-face)
("\\<asDeleteAct\\>" 0 font-lock-builtin-face)
("\\<asRestart\\>" 0 font-lock-builtin-face)
("\\<asParseFile\\>" 0 font-lock-builtin-face)
("\\<asSetAction\\>" 0 font-lock-builtin-face)
("\\<asGetGroupId\\>" 0 font-lock-builtin-face)
("\\<asGetGroupName\\>" 0 font-lock-builtin-face)
("\\<asGetGroupSize\\>" 0 font-lock-builtin-face)
("\\<asGetId\\>" 0 font-lock-builtin-face)
("\\<asStoreRs\\>" 0 font-lock-builtin-face)
("\\<asFindRs\\>" 0 font-lock-builtin-face)
("\\<asStoreString\\>" 0 font-lock-builtin-face)
("\\<asFindString\\>" 0 font-lock-builtin-face)
("\\<asGetBrk\\>" 0 font-lock-builtin-face)
("\\<asGetTime\\>" 0 font-lock-builtin-face)
("\\<asDecryptCfgStr\\>" 0 font-lock-builtin-face)
("\\<asDumpCache\\>" 0 font-lock-builtin-face)
("\\<as[SG]etReqAccept\\>" 0 font-lock-builtin-face)
("\\<as[SG]etReqKillTimeout\\>" 0 font-lock-builtin-face)
("\\<as[SG]etStatus\\>" 0 font-lock-builtin-face)
("\\<as[SG]etReqInitProc\\>" 0 font-lock-builtin-face)
("\\<as[SG]etReqEndProc\\>" 0 font-lock-builtin-face)
("\\<as[SG]etActivatorName\\>" 0 font-lock-builtin-face)
("\\<as[SG]etDefaultAction\\>" 0 font-lock-builtin-face)
("\\<as[SG]etTimeoutProc\\>" 0 font-lock-builtin-face)
("\\<as[SG]etTimeoutInterval\\>" 0 font-lock-builtin-face)
("\\<reqGetNumVals\\>" 0 font-lock-builtin-face)
("\\<reqGetNthName\\>" 0 font-lock-builtin-face)
("\\<reqGetNthVal\\>" 0 font-lock-builtin-face)
("\\<reqGetNumArgs\\>" 0 font-lock-builtin-face)
("\\<reqGetNthArg\\>" 0 font-lock-builtin-face)
("\\<req[SG]etArg\\>" 0 font-lock-builtin-face)
("\\<reqGetArgs\\>" 0 font-lock-builtin-face)
("\\<reqGetRawPost\\>" 0 font-lock-builtin-face)
("\\<reqGetRawPostLen\\>" 0 font-lock-builtin-face)
("\\<reqGetRawPostBytes\\>" 0 font-lock-builtin-face)
("\\<reqGetEnvNames\\>" 0 font-lock-builtin-face)
("\\<req[SG]etEnv\\>" 0 font-lock-builtin-face)
("\\<reqGetId\\>" 0 font-lock-builtin-face)
("\\<inf_begin_tran\\>" 0 font-lock-builtin-face)
("\\<inf_get_dblist\\>" 0 font-lock-builtin-face)
("\\<inf_open_conn\\>" 0 font-lock-builtin-face)
("\\<inf_close_conn\\>" 0 font-lock-builtin-face)
("\\<inf_commit_tran\\>" 0 font-lock-builtin-face)
("\\<inf_rollback_tran\\>" 0 font-lock-builtin-face)
("\\<inf_prep_sql\\>" 0 font-lock-builtin-face)
("\\<inf_exec_stmt\\>" 0 font-lock-builtin-face)
("\\<inf_set_arg\\>" 0 font-lock-builtin-face)
("\\<inf_clear_args\\>" 0 font-lock-builtin-face)
("\\<inf_close_stmt\\>" 0 font-lock-builtin-face)
("\\<inf_exec_stmt_for_fetch\\>" 0 font-lock-builtin-face)
("\\<inf_fetch\\>" 0 font-lock-builtin-face)
("\\<inf_fetch_done\\>" 0 font-lock-builtin-face)
("\\<inf_last_err_num\\>" 0 font-lock-builtin-face)
("\\<inf_last_err_msg\\>" 0 font-lock-builtin-face)
("\\<inf_get_row_count\\>" 0 font-lock-builtin-face)
("\\<inf_get_serial\\>" 0 font-lock-builtin-face)
("\\<inf_get_stmt_list\\>" 0 font-lock-builtin-face)
("\\<inf_get_col_name\\>" 0 font-lock-builtin-face)
("\\<inf_get_col_type\\>" 0 font-lock-builtin-face)
("\\<inf_get_num_cols\\>" 0 font-lock-builtin-face)
("\\<inf_last_isam_msg\\>" 0 font-lock-builtin-face)
("\\<inf_last_isam_num\\>" 0 font-lock-builtin-face)
("\\<db_exec_qry\\>" 0 font-lock-builtin-face)
("\\<db_close\\>" 0 font-lock-builtin-face)
("\\<db_get_nrows\\>" 0 font-lock-builtin-face)
("\\<db_get_row\\>" 0 font-lock-builtin-face)
("\\<db_get_col\\>" 0 font-lock-builtin-face)
("\\<db_get_coln\\>" 0 font-lock-builtin-face)
("\\<db_get_colnames\\>" 0 font-lock-builtin-face)
("\\<db_create\\>" 0 font-lock-builtin-face)
("\\<db_add_row\\>" 0 font-lock-builtin-face)
)
)
;; convert DOS files to UNIX - I can never remember how to do this
(defun dos2unix ()
(interactive)
(set-buffer-file-coding-system 'unix))
;; nice menu for buffers
;(global-set-key "\C-x\C-b" 'electric-buffer-list)
;; completion of buffers to switch to
;(iswitchb-mode t)
;(setq iswitchb-default-method 'samewindow)
(put 'upcase-region 'disabled nil)
;; Red tabs hurt my eyes
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(background "blue")
'(flymake-errline ((((class color)) (:underline "red"))))
'(flymake-warnline ((((class color)) (:underline "blue"))))
'(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Turquoise"))))
'(font-lock-comment-face ((t (:foreground "MediumAquamarine"))))
'(font-lock-constant-face ((((class color) (background dark)) (:bold t :foreground "DarkOrchid"))))
'(font-lock-doc-string-face ((t (:foreground "green2"))))
'(font-lock-function-name-face ((t (:foreground "SkyBlue"))))
'(font-lock-keyword-face ((t (:bold t :foreground "CornflowerBlue"))))
'(font-lock-preprocessor-face ((t (:italic nil :foreground "CornFlowerBlue"))))
'(font-lock-reference-face ((t (:foreground "DodgerBlue"))))
'(font-lock-string-face ((t (:foreground "LimeGreen"))))
'(font-lock-type-face ((t (:foreground "#9290ff"))))
'(font-lock-variable-name-face ((t (:foreground "PaleGreen"))))
'(font-lock-warning-face ((((class color) (background dark)) (:foreground "yellow" :background "red"))))
'(highlight ((t (:background "CornflowerBlue"))))
'(list-mode-item-selected ((t (:background "gold"))))
'(makefile-space-face ((t (:background "wheat"))))
'(mode-line ((t (:background "Navy"))))
'(paren-match ((t (:background "darkseagreen4"))))
'(region ((t (:background "DarkSlateBlue"))))
'(show-paren-match ((t (:foreground "black" :background "wheat"))))
'(show-paren-mismatch ((((class color)) (:foreground "white" :background "red"))))
'(speedbar-button-face ((((class color) (background dark)) (:foreground "green4"))))
'(speedbar-directory-face ((((class color) (background dark)) (:foreground "khaki"))))
'(speedbar-file-face ((((class color) (background dark)) (:foreground "cyan"))))
'(speedbar-tag-face ((((class color) (background dark)) (:foreground "Springgreen"))))
'(vhdl-speedbar-architecture-selected-face ((((class color) (background dark)) (:underline t :foreground "Blue"))))
'(vhdl-speedbar-entity-face ((((class color) (background dark)) (:foreground "darkGreen"))))
'(vhdl-speedbar-entity-selected-face ((((class color) (background dark)) (:underline t :foreground "darkGreen"))))
'(vhdl-speedbar-package-face ((((class color) (background dark)) (:foreground "black"))))
'(vhdl-speedbar-package-selected-face ((((class color) (background dark)) (:underline t :foreground "black"))))
'(widget-field ((((class grayscale color) (background light)) (:background "DarkBlue")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment