Skip to content

Instantly share code, notes, and snippets.

@johnfredcee
Created March 24, 2013 16:11
Show Gist options
  • Save johnfredcee/5232487 to your computer and use it in GitHub Desktop.
Save johnfredcee/5232487 to your computer and use it in GitHub Desktop.
Emacs Init for Samsung Laptop
;; generic Emacs utility
;;; ------------------------------------------------------------------
(defun add-subdirs-to-load-path (dir)
(let ((default-directory (concat dir "/")))
(normal-top-level-add-subdirs-to-load-path)))
;;; basic load-path setup
;;; ------------------------------------------------------------------
(add-to-list 'load-path (convert-standard-filename (expand-file-name "~/.emacs.d")))
(add-subdirs-to-load-path (convert-standard-filename (expand-file-name "~/.emacs.d")))
(require 'tramp)
(require 'color-theme)
(color-theme-initialize)
(setq frame-title-format "Emacs: %b (%m)")
(setq visible-bell 't)
(require 'etags-select)
(require 'ibuffer)
(require 'savehist)
(require 'imenu)
(require 'yasnippet)
(yas-global-mode 1)
(require 'semantic/find)
(require 'pos-tip)
(require 'popup-kill-ring)
;; (require 'auto-complete-config)
;; (add-to-list 'ac-dictionary-directories (expand-file-name "~/.emacs.d/ac-dict"))
;; (ac-config-default)
;; (require 'auto-complete-etags)
;; (global-set-key "\M-y" 'popup-kill-ring)
;; (setq-default ac-sources '(ac-source-yasnippet ac-source-semantic ac-source-words-in-buffer ac-source-words-in-all-buffer))
(require 'skeleton)
(require 'doc-mode)
;; (require 'perspective)
;; (require 'glsl-mode)
;; (require 'paredit)
;; (require 'csharp-mode)
(require 'flymake)
(require 'flymake-cursor)
(require 'eproject)
(require 'scons-flymake)
(require 'eproject-extras)
(require 'windmove)
;; (require 'css-mode)
;; (require 'flycheck)
(require 'thingatpt)
(require 'c-func-doc)
(require 'hi-symbol)
(require 'super-syntax)
(require 'ogre-material-mode)
;; emacs needs grep & co
(setenv "INFOPATH" (concat (convert-standard-filename "/wsr/apps/emacs-24.2/info") path-separator (getenv "INFOPATH")))
;;in the .emacs
(ido-mode t)
(setq ido-enable-flex-matching nil) ;; enable fuzzy matching
;; want to use capslock as a modifier
(setq w32-pass-lwindow-to-system nil) ;; want to use this as windmove modifier
(setq w32-lwindow-modifier nil)
(setq w32-recognize-altgr nil) ;; make altgr = ctrl + meta
(global-linum-mode 1)
(global-set-key [(meta kp-8)] 'windmove-up)
(global-set-key [(meta kp-4)] 'windmove-left)
(global-set-key [(meta kp-6)] 'windmove-right)
(global-set-key [(meta kp-2)] 'windmove-down)
(global-set-key [(meta kp-add)] 'hs-show-block)
(global-set-key [(control meta kp-add)] 'hs-show-all)
(global-set-key [(meta kp-subtract)] 'hs-hide-block)
(global-set-key [(control meta kp-subtract)] 'hs-hide-all)
(global-set-key [f12] 'ibuffer)
(global-set-key [(meta f12)] 'bookmark-bmenu-list)
(global-set-key [(meta f7)] 'compile)
(global-set-key [f7] 'recompile)
(global-set-key [(control f7)] 'compilation-minor-mode)
(global-set-key [(control meta f)] 'find-file-at-point)
(global-set-key [(control x)(control z)] 'other-window)
;; overload search on k3 (shift=backward, meta=regexp)
(global-set-key [(f3)] 'search-forward)
(global-set-key [(shift f3)] 'search-backward)
(global-set-key [(meta f3)] 'search-forward-regexp)
(global-set-key [(shift meta f3)] 'search-backward-regexp)
;; overload replacement on k4 (meta == regexp, control = query)
(global-set-key [(f4)] 'replace-string)
(global-set-key [(control f4)] 'query-replace)
(global-set-key [(meta f4)] 'replace-regexp)
(global-set-key [(control meta f4)] 'query-replace-regexp)
(global-set-key [(f5)] 'tags-loop-continue)
(global-set-key [(shift f5)] 'tags-search)
(global-set-key [(control f5)] 'tags-query-replace)
(global-set-key [(f6)] 'yas-insert-snippet)
(global-set-key [(control meta f)] 'forward-sexp)
(global-set-key [(control meta b)] 'backward-sexp)
(defun kill-to-register (register start end &optional delete-flag)
(interactive "cKill to register: \nr\nP")
(set-register register (filter-buffer-substring start end))
(delete-region start end))
(global-set-key [(control c)(control w)] 'kill-to-register)
(global-set-key [(control c)(meta w)] 'copy-to-register)
(global-set-key [(control c)(control y)] 'insert-register)
;; zap shouldn't be greedy -------------------------------------
(defun zap-upto-char (arg char)
"Kill up to but not including ARG'th occurrence of CHAR.
Case is ignored if `case-fold-search' is non-nil in the current buffer.
Goes backward if ARG is negative; error if CHAR not found."
(interactive "p\ncZap upto char: ")
(if (char-table-p translation-table-for-input)
(setq char (or (aref translation-table-for-input char) char)))
(kill-region (point)
(progn
(search-forward (char-to-string char) nil nil arg)
(if (minusp arg)
(forward-char 1)
(backward-char 1))
; (goto-char (if (> arg 0) (1- (point)) (1+ (point))))
(point))))
(global-set-key [(meta z)] 'zap-upto-char)
(global-set-key [(meta s) (c)] 'cmd-shell)
(global-set-key [(meta s) (e)] 'w32shell-explorer)
;; rebind home keys to something less potty
(global-set-key [(meta v)] 'next-line)
(global-set-key [(ctrl v)] 'next-line)
(global-set-key [(meta r)] 'previous-line)
(global-set-key [(ctrl r)] 'previous-line)
(global-set-key [(ctrl meta t)] 'smart-symbol-go-backward)
(global-set-key [(ctrl meta v)]' smart-symbol-go-forward)
(defun forward-to-char (arg char)
(interactive "p\ncForward to char: ")
(if (char-table-p translation-table-for-input)
(setq char (or (aref translation-table-for-input char) char)))
(search-forward (char-to-string char) nil nil arg))
(defun backward-to-char (arg char)
(interactive "p\ncBackward to char: ")
(if (char-table-p translation-table-for-input)
(setq char (or (aref translation-table-for-input char) char)))
(search-backward (char-to-string char) nil nil arg))
(global-set-key [(meta t)] 'forward-to-char)
(global-set-key [(ctrl meta t)] 'backward-to-char)
(global-set-key [(control delete)] 'kill-syntax)
;; handy for inserting into regexps
(defun camelcase (str)
(concat (downcase (string (aref str 0))) (substring str 1)))
;; buffer dedication
(defun toggle-window-dedicated ()
"Toggle whether the current active window is dedicated"
(interactive)
(message
(if (let (window (get-buffer-window (current-buffer)))
(set-window-dedicated-p window
(not (window-dedicated-p window))))
"Window '%s' is dedicated"
"Window '%s' is normal")
(current-buffer)))
(setq frame-title-format (concat invocation-name "@" system-name ": %b %+%+ %f"))
(global-set-key [f8] 'indent-region)
(defun astyle-buffer ()
(interactive)
(shell-command-on-region (point-min) (point-max)
"astyle --style=java --unpad-paren --keep-one-line-blocks --delete-empty-lines --indent=force-tab=4 --indent-switches --indent-cases --indent-namespaces" ;; add options here...
(current-buffer) t
(get-buffer-create "*Astyle Errors*") t))
(global-set-key [(meta f8)] 'astyle-buffer)
;; -- tagging should use ectags and be available from withih emacs --------------------
(defun tag-directory ()
(interactive)
(shell-command
(concat
"ectags --verbose --recurse -e -o TAGS --c++-kinds=cfnstunedmpxd --c-kinds=cfnstunedmpxd ."))
(visit-tags-table "TAGS"))
(defun tag-c++ ()
(interactive)
(shell-command
(concat
"dir /b /s *.cpp *.h *.cxx *.hpp *.hh | ectags --verbose -e -o TAGS --language-force=c++ --c++-kinds=cfnstunedm --extra=+q -L -"))
(visit-tags-table "TAGS"))
(defun tag-c ()
(interactive)
(shell-command
(concat
"dir /b /s *.c *.h | ectags --options=ectags.cnf --verbose -e -o TAGS --language-force=c --c-kinds=cfnstunedm -L -"))
(visit-tags-table "TAGS"))
(defun tag-headers ()
(interactive)
(shell-command
(concat
"dir /b /s *.h *.hxx *.hpp *.hh | ectags --options=~/ectags.cnf --verbose -e -o TAGS --c-kinds=+pxd --c++-kinds=+pxd --extra=+q -L -"))
(visit-tags-table "TAGS"))
(global-set-key "\M-." 'etags-select-find-tag)
(global-set-key "\M-," 'pop-tag-mark)
(define-key ac-completing-map "\M-n" 'ac-next)
(define-key ac-completing-map "\M-p" 'ac-previous)
(defun goto-match-paren (arg)
"Go to the matching if on (){}[], similar to vi style of % "
(interactive "p")
;; first, check for "outside of bracket" positions expected by forward-sexp, etc.
(cond ((looking-at "\\s(") (forward-sexp))
((looking-back "\\s)" 1) (backward-sexp))
;; now, try to succeed from inside of a bracket
((looking-at "\\s)") (forward-char) (backward-sexp))
((looking-back "\\s(" 1) (backward-char) (forward-sexp))
(t nil)))
(global-set-key "\M-&" 'goto-match-paren)
(global-set-key [(meta f9)] 'highlight-symbol-at-point)
;; -- HELP ------------------------------
(defun search-site-url (keyword &optional site inurl lucky)
"Do a Google search for KEYWORD. Restrict to SITE and INURL, if specified.
Jump to best match (I Feel Lucky) if LUCKY set.
"
(concat "http://www.google.com/"
(format "search?q=%s" (url-hexify-string keyword))
(if site (format "+site:%s" (url-hexify-string site)))
(if inurl (format "+inurl:%s" (url-hexify-string inurl)))
(if lucky "&btnI")))
(defun context-help ()
"Open a browser window showing documentation for the word under the point.
Uses `major-mode' to optionally refine the search to a specific web site,
or a specific pattern in the URL. Defaults to a simple keyword search.
Uses `search-site-url' to do the actual search.
"
(interactive)
(browse-url
(apply 'search-site-url
(thing-at-point 'symbol)
(cond
((equal major-mode 'css-mode)
'("www.w3schools.com" "/css/" t))
((equal major-mode 'emacs-lisp-mode)
'("www.gnu.org" "/emacs/"))
((or (equal major-mode 'html-mode)
(equal major-mode 'html-helper-mode))
'("www.htmlquick.com" "/reference/" t))
((equal major-mode 'javascript-mode)
'("www.w3schools.com" nil t))
((equal major-mode 'python-mode)
'("docs.python.org" "/ref/" t))
((equal major-mode 'c++-mode)
'("en.cppreference.com" nil t))
(t nil)))))
(defvar library-help-methods nil)
(defun library-help-selector ()
(interactive)
(message "Select [%s]: "
(apply #'string (mapcar #'car library-help-methods)))
(let* ((ch (save-window-excursion
(select-window (minibuffer-window))
(read-char)))
(selector (find ch library-help-methods :key #'car)))
(cond ((null selector)
(message (format "No method for character: %s" ch))
(ding)
(sleep-for 1)
(discard-input)
(library-help-selector))
(t
(browse-url
(apply 'search-site-url
(thing-at-point 'symbol)
(third selector)))))))
(defmacro def-library-selector-method (key description search-params)
`(setq library-help-methods
(sort* (cons (list ,key ,description ,search-params)
(remove* ,key library-help-methods :key #'car))
#'< :key #'car)))
(global-set-key [(control meta f1)] 'context-help)
(global-set-key [(control f1)] 'library-help-selector)
(def-library-selector-method ?w "WxWidgets" '("docs.wxwidgets.org" "/trunk/" nil))
(def-library-selector-method ?o "Ogre" '("www.ogre3d.org" "/docs/api/html/" nil))
;; -- C++ ---------------------------------------------
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode)) ;; to clobber inform-maybe-mode
(add-to-list 'auto-mode-alist '("\\.inl$" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.xrc$" . xml-mode))
(add-to-list 'auto-mode-alist '("SConscript" . python-mode))
(add-to-list 'auto-mode-alist '("SConstruct" . python-mode))
(add-to-list 'auto-mode-alist '("\\.d$" . c-mode)) ;; for working with ECLs
(add-to-list 'auto-mode-alist '("\\.asd$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.as$" . actionscript-mode))
(add-to-list 'auto-mode-alist '("\\.uc$" . unrealscript-mode))
(defconst playbox-c-style
;; Always indent c/c++ sources, never insert tabs
'((c-tab-always-indent . t)
;; Offset for line only comments
(c-basic-offset . 4)
(c-comment-only-line-offset . 0)
;; Controls the insertion of newlines before and after braces.
(c-hanging-braces-alist . ((substatement-open after)
(class-open)
(class-close)
(brace-list-open)))
;; Controls the insertion of newlines before and after certain colons.
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(case-label after)
(label after)
(access-label after)))
;; List of various C/C++/ObjC constructs to "clean up".
(c-cleanup-list . (scope-operator
empty-defun-braces
defun-close-semi))
;; Association list of syntactic element symbols and indentation offsets.
(c-offsets-alist . ((arglist-close . c-lineup-arglist)
(substatement-open . 0)
(case-label . +)
(block-open . 0)
(innamespace . 0)
(inextern-lang . 0)
(inline-open . 0)
(access-label . -)
(label . 0)
(knr-argdecl-intro . -)))
(c-echo-syntactic-information-p . t))
"Playbox C/C++ Programming Style")
(c-add-style "playbox" playbox-c-style)
;; assume filename is same as classname
(defun get-class-name ()
(file-name-nondirectory (file-name-sans-extension buffer-file-name)))
;; insert it interactively
(defun insert-class-name ()
(interactive)
(insert (get-class-name)))
(defun h-file-create ()
"Create a new h file. Insert a infdef/define/endif block"
(interactive)
(if (or (equal (substring (buffer-name (current-buffer)) -2 ) ".h")
(equal (substring (buffer-name (current-buffer)) -4 ) ".hpp"))
(if (equal "" (buffer-string))
(insert "#ifndef "(upcase (substring (buffer-name (current-buffer)) 0 -2)) "_H\n#define "
(upcase (substring (buffer-name (current-buffer)) 0 -2)) "_H\n\n#endif"))))
(defun forward-c-token ()
(interactive)
(c-forward-token-2 1))
(defun backward-c-token ()
(interactive)
(c-backward-token-2 1))
(defun c-wx-lineup-topmost-intro-cont (langelem)
(save-excursion
(beginning-of-line)
(if (re-search-forward "EVT_" (line-end-position) t)
'c-basic-offset
(c-lineup-topmost-intro-cont langelem))))
(add-to-list 'c++-font-lock-extra-types
"\bwx[A-Z][a-z][a-zA-Z]*?\b" "\bSo[A-Z][a-z][a-zA-Z]*?\b")
(add-hook 'c-mode-common-hook
'(lambda ()
(setq case-fold-search nil)
(c-set-style "playbox")
;; Do not check for old-style (K&R) function declarations;
;; this speeds up indenting a lot.
(setq c-recognize-knr-p nil)
(setq c-basic-offset 4)
(setq compile-command "scons -u ")
(setq dabbrev-case-fold-search nil)
(setq dabbrev-case-replace nil)
(setq dabbrev-case-distinction nil)
(hs-minor-mode 1)
(h-file-create)
(c-set-offset 'topmost-intro-cont 'c-wx-lineup-topmost-intro-cont)
(semantic-mode 1)
;; (setq skeleton-pair t)
;; (local-set-key "(" 'skeleton-pair-insert-maybe)
;; (local-set-key "[" 'skeleton-pair-insert-maybe)
;; (local-set-key "{" 'skeleton-pair-insert-maybe)
(local-set-key [(meta f)] 'forward-c-token)
(local-set-key [(meta b)] 'backward-c-token)
(setq smart-use-extended-syntax t)
(local-set-key [(meta ?#)] 'insert-class-name)
(local-set-key [(meta f11)] 'doc-mode-add-tag-doc)))
;; GLSL --------------------------------------------------
(autoload 'glsl-mode "glsl-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . glsl-mode))
;; SLIME ----------------------------------------
(add-to-list 'load-path "~/.emacs.d/slime")
(defun lisp-setup ()
(lambda ()
(local-set-key [(meta i)] 'hyperspec-lookup)))
(defun scratch-lisp-file ()
"Insert a template (with DEFPACKAGE and IN-PACKAGE forms) into
the current buffer."
(interactive)
(goto-char 0)
(let* ((file (file-name-nondirectory (buffer-file-name)))
(package (file-name-sans-extension file)))
(insert ";;;; " file "\n")
(insert "\n(defpackage #:" package "\n (:use #:cl))\n\n")
(insert "(in-package #:" package ")\n\n")))
(require 'slime-autoloads)
(add-to-list 'load-path (convert-standard-filename "~/.emacs.d/slime/contrib"))
;(slime-setup '(slime-fancy slime-asdf))
(slime-setup '(slime-repl slime-scratch slime-asdf))
(setq slime-net-coding-system 'utf-8-unix)
(setq slime-lisp-implementations
'((ccl ("C:\\wsr\\lisp\\ccl\\wx86cl.exe" "-l" "C:/wsr/lisp/ccl/cclrc.lisp"))
(cclx64 ("C:\\wsr\\lisp\\ccl\\wx86cl64.exe" "-l" "C:/wsr/lisp/ccl/cclrc.lisp"))
(abcl ("C:\\wsr\\lisp\\abcl\\abcl.bat"))
(clisp ("C:\\wsr\\lisp\\clisp\\clisp.exe"));; "-i" "C:\\wsr\\lisp\\clisp\\slime-init.lisp"))
(sbcl ("C:\\wsr\\lisp\\sbcl\\sbcl.exe" "--core" "/wsr/lisp/sbcl//sbcl.core" "--sysinit" "/wsr/lisp/sbcl/sbclrc"))))
(defmacro defslime-start (name mapping)
`(defun ,name ()
(interactive)
(let ((slime-default-lisp ,mapping))
(slime))))
(add-to-list 'load-path "~/.emacs.d/clojure-mode")
(autoload 'clojure-mode "clojure-mode" "A major mode for Clojure" t)
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
(defslime-start abcl 'abcl)
(defslime-start sbcl 'sbcl)
(defslime-start cclx64 'cclx64)
(defslime-start ccl 'ccl)
(defslime-start clojure 'clojure)
(defun run-ccl ()
(interactive)
(run-lisp "C:\\wsr\\lisp\\ccl\\wx86cl.exe -l C:/wsr/lisp/ccl/cclrc.lisp"))
(defun run-cclx64 ()
(interactive)
(run-lisp "C:\\wsr\\lisp\\ccl\\wx86cl64.exe -l C:/wsr/lisp/ccl/cclrc.lisp"))
(defun run-lispworks ()
(interactive)
(shell-command "C:\\wsr\\lisp\\lwp-slime.vbs&"))
(defun run-clojure ()
(interactive)
(run-lisp "java -cp c:\\wsr\\lisp\\clojure-1.2.0\\clojure-1.2.0.jar clojure.main"))
(add-hook 'lisp-mode-hook
(lambda ()
(local-set-key [(meta control F)] 'forward-sexp)
(local-set-key [(meta control B)] 'backward-sexp)))
(add-hook 'slime-mode-hook
(lambda ()
(setq slime-truncate-lines nil)))
(setq common-lisp-hyperspec-root "file:/C:\\wsr\\lisp\\Hyperspec\\")
(add-to-list 'ac-modes 'lisp-mode)
(add-to-list 'ac-modes 'slime-repl-mode)
(defun ac-slime-candidates ()
"Complete candidates of the symbol at point."
(let* ((end (point))
(beg (slime-symbol-start-pos))
(prefix (buffer-substring-no-properties beg end))
(result (slime-simple-completions prefix)))
(car result)))
(defvar ac-source-slime
'((candidates . ac-slime-candidates)))
(defun my-ac-slime-mode ()
(setq ac-sources
'(ac-source-slime ac-source-words-in-same-mode-buffers ac-source-dictionary)))
(add-hook 'slime-mode-hook 'my-ac-slime-mode)
(add-hook 'slime-repl-mode-hook 'my-ac-slime-mode)
;; -- UNREALSCRIPT --------------------------------------------------------------
(require 'unrealscript-mode)
(defcustom udk-location "C:\\UDK\\UDK-2012-05\\"
"Directory where udk executables are found"
:type 'directory
:group 'udk)
(defcustom udk-map "NavTestMap"
"Name of the map to launch the Unreal game with"
:type 'string
:group 'udk)
(defcustom udk-game "ExperimentalGame.ExperimentalGameInfo"
"Name of the Game Info Class in Unrealscript that runs the game"
:type 'string
:group 'udk)
(defcustom udk-executable (concat udk-location "Binaries\\UDKLift.exe")
"Executable to launch game or editor with"
:type 'file
:group 'udk)
(defcustom udk-log (concat udk-location "UDKGame\\Logs\\Launch.log")
"Log file to monitor for game progress"
:type 'file
:group 'udk)
(defun udk-builder ()
(concat udk-location "Binaries\\Win32\\UDK.com"))
(defun udk-build (arg)
(interactive "P")
(shell-command (concat (udk-builder) " make " (if arg "" " -debug")) "*Build*" "*UDK Build Errors*"))
(defun udk-rebuild (arg)
(interactive "P")
(shell-command (concat (udk-builder) " make " (if arg "" " -debug") " -full") "*Build*" "*UDK Build Errors*"))
(defun udk-game (arg)
(interactive "P")
(shell-command (concat (udk-builder) (format " %s?%s -vadebug -nomoviestartup -ConsolePosX=0 -ConsolePosY=0 " udk-map udk-game) (if arg "" " -debug") " &") nil nil)
(select-window (split-window))
(find-file-read-only udk-log)
(end-of-buffer)
(compilation-minor-mode 1)
(setq auto-revert-interval 1)
(auto-revert-tail-mode 1))
(defun udk-edit (arg)
(interactive "P")
(shell-command (concat udk-executable " editor " (format "%s.upk" udk-map) " " (if arg "" " -debug") " &"))
(select-window (split-window))
(find-file-read-only udk-log)
(end-of-buffer)
(compilation-minor-mode 1)
(auto-revert-tail-mode 1))
(defconst unrealscript-keywords
(sort
(list
"abstract" "always" "array" "arraycount" "assert"
"auto" "automated" "bool" "break" "button"
"byte" "case" "class" "coerce" "collapsecategories"
"config" "const" "continue" "default" "defaultproperties"
"delegate" "dependson" "deprecated" "do" "dontcollapsecategories"
"edfindable" "editconst" "editconstarray" "editinline" "editinlinenew"
"editinlinenotify" "editinlineuse" "else" "enum" "enumcount"
"event" "exec" "expands" "export" "exportstructs"
"extends" "false" "final" "float" "for"
"foreach" "function" "global" "globalconfig" "goto"
"guid" "hidecategories" "if" "ignores" "import"
"init" "input" "insert" "instanced" "int"
"intrinsic" "invariant" "iterator" "latent" "length"
"local" "localized" "name" "native" "nativereplication"
"new" "noexport" "none" "noteditinlinenew" "notplaceable"
"nousercreate" "operator" "optional" "out" "perobjectconfig"
"placeable" "pointer" "postoperator" "preoperator" "private"
"protected" "reliable" "remove" "replication" "return"
"rng" "rot" "safereplace" "self" "showcategories"
"simulated" "singular" "skip" "state" "static"
"stop" "string" "struct" "super" "switch"
"transient" "travel" "true" "unreliable" "until"
"var" "vect" "while" "within") #'(lambda (a b) (> (length a) (length b))))
"Source for unrealscript keywords.")
(defvar ac-source-unrealscript-keywords
'((candidates
. (lambda ()
(all-completions ac-target unrealscript-keywords))))
(add-hook 'unrealascript-mode-hook
(lambda ()
(setq ac-sources '(ac-source-unrealscript-keywords ac-source-words-in-same-mode-buffers ac-source-etags))
;; (auto-complete-mode 1)
;; (yas/minor-mode-on) when we try adding snippets
(c-set-style "unrealscript"))))
(defun flymake-unrealscript-init ()
(setq flymake-base-dir udk-location)
(list (concat udk-location "\\Binaries\\Win32\\UDK.com") '("make" "-debug")))
(defun flymake-unrealscript-cleanup ()
;; nothing to do
)
(defun flymake-unrealscript-getfn (filename)
filename)
(setq flymake-allowed-file-name-masks
(cons '(".+\\.uc$"
flymake-unrealscript-init
flymake-unrealscript-cleanup
flymake-unrealscript-getfn)
flymake-allowed-file-name-masks))
(setq flymake-err-line-patterns
(cons '("^\\(.+\\)(\\([0-9]+\\)) : Error,\\(.+\\)"
1 2 nil 3)
flymake-err-line-patterns))
;; -- MONGODB ------------------------------------
(defun go-mongo ()
(interactive)
(setenv "PATH" (concat "C:\\wsr\\Mongodb\\bin\\" path-separator (getenv "PATH")))
(async-shell-command "mongod -dbpath .\\data" (generate-new-buffer "*MongoDB Log*") (generate-new-buffer "*MongoDB Errors*")))
;; -- PYTHON -------------------------------------
(add-hook 'python-mode-hook
(lambda ()
;; this hook is local, can't add it globally
(add-hook 'write-contents-functions 'delete-trailing-whitespace)
(setq ac-sources '(ac-source-words-in-same-mode-buffers ac-source-yasnippet))
;; (ac-ropemacs-setup)
;; (auto-complete-mode 1)
(setq indent-tabs-mode t)
(setq tab-width 4)
(setq python-indent 4)))
;; -- GOOGLE APPENGINE ----------------------------------------------------------------------
(defun use-appengine ()
"Set up environment for using Google App Engine"
(interactive)
(setenv "PATH" (concat "C:\\Python25" path-separator "C:\\Program Files\ (x86)\\Google\\google_appengine" (getenv "PATH"))))
(defun run-google-appengine (path)
"Run an app in the async buffer"
(interactive "DApp to run: ")
(async-shell-command (concat "C:\\Python25\\python \"C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py\" --debug " path)))
(global-auto-revert-mode)
(defun use-scons ()
(interactive)
(setenv "PATH" (concat "C:\\Python27" path-separator "C:\\Python27\\Scripts" path-separator (getenv "PATH"))))
(defun use-mingw ()
(interactive)
(setenv "PATH" (concat "C:\\wsr\\mingw32\\bin" path-separator (getenv "PATH"))))
(defun use-mingw64 ()
(interactive)
(setenv "PATH" (concat "C:\\wsr\\mingw64\\bin" path-separator (getenv "PATH"))))
(defun use-git ()
(interactive)
(setenv "PATH" (concat (getenv "PATH") path-separator "C:\\Program Files (x86)\\Git\\cmd" path-separator "C:\\Program Files (x86)\\Git\\bin")))
(defun make-some-files-read-only ()
"when file opened is of a certain mode, make it read only"
(when (memq major-mode '(c++-mode python-mode c-mode actionscript-mode unrealscript-mode lisp-mode))
(toggle-read-only 1)))
(add-hook 'find-file-hook 'make-some-files-read-only)
;; CSHARP ------------------------------------------------------------------------------
(add-to-list 'load-path "~/.emacs.d/csharp")
(require 'csharp-mode)
(setq auto-mode-alist
(append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
(defun my-csharp-mode-fn ()
(setq case-fold-search nil)
(c-set-style "C#")
(setq c-recognize-knr-p nil)
(setq c-basic-offset 4)
(setq dabbrev-case-fold-search nil)
(setq dabbrev-case-replace nil)
(setq dabbrev-case-distinction nil)
;; (semantic-mode 1)
(setq ac-sources '(ac-source-words-in-same-mode-buffers ac-source-yasnippet))
(local-set-key [(meta ?#)] 'insert-class-name))
(add-hook 'csharp-mode-hook 'my-csharp-mode-fn t)
(setenv "PATH" (concat "c:\\wsr\\usr\\local\\wbin" path-separator (getenv "PATH")))
(setq grep-find-use-xargs 'exec)
;; BACKUPS ------------------------------------------------------------------------
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
(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.
'(ac-auto-start 3)
'(ac-candidate-limit 16)
'(ac-delay 0.2)
'(ac-dwim t)
'(ac-use-fuzzy t)
'(ack-prompt-for-directory t)
'(ack-root-directory-functions nil)
'(clojure-src-root "c:/wsr/lisp/clojure-1.2.0")
'(compilation-window-height 16)
'(desktop-globals-to-save (quote (desktop-missing-file-warning tags-file-name tags-table-list search-ring regexp-search-ring register-alist file-name-history bookmark-default-file)))
'(desktop-modes-not-to-save nil)
'(desktop-path (quote ("." "~/.emacs.d/" "~")))
'(display-buffer-reuse-frames t)
'(flymake-gui-warnings-enabled nil)
'(flymake-log-level 3)
'(flymake-no-changes-timeout 6.0)
'(flymake-start-syntax-check-on-find-file nil)
'(flymake-start-syntax-check-on-newline nil)
'(grep-command nil)
'(grep-files-aliases (quote (("all" . "* .*") ("el" . "*.el") ("ch" . "*.[ch]") ("c" . "*.c") ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++") ("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++") ("hh" . "*.hxx *.hpp *.[Hh] *.HH *.h++") ("h" . "*.h") ("l" . "[Cc]hange[Ll]og*") ("m" . "[Mm]akefile*") ("tex" . "*.tex") ("texi" . "*.texi") ("asm" . "*.[sS]") (uc . "*.uc") (ini . "*.ini"))))
'(grep-find-command nil)
'(grep-find-ignored-files (quote (".#*" "*.o" "*~" "*.bin" "*.bak" "*.obj" "*.map" "*.ico" "*.pif" "*.lnk" "*.a" "*.ln" "*.dll" "*.drv" "*.386" "*.elc" "*.idx" "*.lot" "*.fmt" "*.class" "*.fas" "*.lib" "*.mem" "*.x86f" "*.fasl" "*.ufsl" "*.fsl" "*.dxl" "*.lo" "*.la" "*.toc" "*.cp" "*.fn" "*.pg" "*.tp" "*.pyc" "*.pyo")))
'(grep-find-template nil)
'(grep-template nil)
'(grep-use-null-device (quote auto-detect))
'(gud-gud-gdb-command-name "c:\\\\wsr\\\\mingw32\\\\bin\\\\gdb --fullname")
'(ido-cannot-complete-command (quote ido-next-match))
'(ido-everywhere nil)
'(ido-use-filename-at-point (quote guess))
'(ido-use-url-at-point t)
'(pop-up-frames nil)
'(pop-up-windows nil)
'(rcirc-authinfo (quote (("irc.freenode.net" nickserv "ZabaQ" "###########"))))
'(rcirc-default-full-name "John Connors")
'(rcirc-default-nick "ZabaQ")
'(rcirc-default-user-name "Zaba")
'(rcirc-server-alist (quote (("irc.freenode.net" :nick "Zabaq" :channels ("#lisp" "#lispgames" "#lua" "#cityscape" "##OpenGL")))))
'(reb-re-syntax (quote read))
'(safe-local-variable-values (quote ((Package . PHOTONS) (Base . 10) (Package . CL-USER) (Syntax . COMMON-LISP))))
'(same-window-buffer-names (quote ("*Python*" "*shell*" "*mail*" "*inferior-lisp*" "*ielm*" "*scheme*" "*compilation*")))
'(same-window-regexps (quote ("\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)" "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)" "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)" "\\*info\\*\\(\\|<[0-9]+>\\)" "\\*gud-.*\\*\\(\\|<[0-9]+>\\)" "\\`\\*Customiz.*\\*\\'" "\\*compilation\\*")))
'(scroll-conservatively 1)
'(scroll-preserve-screen-position 1)
'(scroll-step 1)
'(semantic-default-submodes nil)
'(semantic-python-dependency-system-include-path (quote ("C:\\\\Python26")))
'(semanticdb-persistent-path (quote (never)))
'(show-paren-mode t)
'(size-indication-mode t)
'(split-height-threshold nil)
'(split-width-threshold nil)
'(swank-clojure-classpath (quote ("\\wsr\\lisp\\clojure-1.1.0\\clojure.jar" "\\wsr\\lisp\\clojure-contrib-1.1.0\\clojure-contrib.jar" "\\users\\zaba\\appdata\\roaming\\.emacs.d\\swank-clojure\\swank-clojure-1.2.1.jar")))
'(swank-clojure-extra-vm-args (list "-server" "-Xms128M" "-Xmx512M" "-Dfile.encoding=UTF-8"))
'(swank-clojure-jar-home "\\users\\zaba\\appdata\\roaming\\.emacs.d\\swank-clojure\\")
'(swank-clojure-java-path (convert-standard-filename "/Program Files (x86)/Java/jdk1.6.0_16/bin/java.exe"))
'(tab-width 4)
'(tool-bar-mode nil)
'(udk-game "ShadowLibrary.LibraryGameInfo")
'(udk-location "C:\\UDK\\UDK-2012-05\\")
'(udk-log "C:\\UDK\\UDK-2012-05\\UDKGame\\Logs\\Launch.log")
'(udk-map "ShadowTestMap.udk")
'(uniquify-buffer-name-style (quote forward) nil (uniquify))
'(vc-handled-backends nil)
'(w32shell-emacsw32-gnuwin32-bindir "C:\\wsr\\usr\\local\\wbin")
'(w32shell-msys-bin "\\wsr\\msys\\bin")
'(w32shell-shell (quote cmd))
'(w32shell-wanted-progs nil)
'(window-min-height 3)
'(winner-boring-buffers (quote ("*Completions*" "*Buffer List*" "*Info*")))
'(winner-mode t nil (winner)))
(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.
'(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 83 :width normal :foundry "outline" :family "Monaco"))))
'(minibuffer-prompt ((t (:foreground "dark slate gray")))))
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment