Skip to content

Instantly share code, notes, and snippets.

@bastih
Created August 12, 2010 09:01
Show Gist options
  • Save bastih/520606 to your computer and use it in GitHub Desktop.
Save bastih/520606 to your computer and use it in GitHub Desktop.
(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.
)
(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.
)
(add-to-list 'load-path "~/.emacs.d/vendor/textmate.el")
(require 'textmate)
(textmate-mode)
(add-to-list 'load-path "~/.emacs.d/color-theme")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-hober)))
(setq standard-indent 2)
(setq c-default-style "bsd"
c-basic-offset 4
tab-width 4)
(setq-default indent-tabs-mode nil)
(setq require-final-newline t)
(fset 'yes-or-no-p 'y-or-n-p)
(setq next-line-add-newlines nil)
(setq display-time-day-and-date t) (display-time)
(require 'paren) (show-paren-mode t)
(transient-mark-mode t)
(setq search-highlight t)
(setq auto-mode-alist
(append '(("\\.h$" . c++-mode)) auto-mode-alist))
(load-file "~/.emacs.d/cedet/common/cedet.el")
(global-ede-mode t)
(semantic-load-enable-code-helpers)
(setq semantic-load-turn-useful-things-on t)
(setq semanticdb-project-roots
(list "~/dev/hyrise/imhserver")
)
(semantic-load-enable-excessive-code-helpers)
(require 'semantic-ia)
(require 'semantic-gcc)
(ede-cpp-root-project "hyrise"
:name "hyrise"
:file "~/dev/hyrise/imhserver/Makefile"
:include-path '("/src/lib"
)
:system-include-path '("/usr/lib/include"
"/usr/include"
))
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(require 'cl) ; If you don't have it already
(defun upward-find-file (filename &optional startdir)
"Move up directories until we find a certain filename. If we
manage to find it, return the containing directory. Else if we
get to the toplevel directory and still can't find it, return
nil. Start at startdir or . if startdir not given"
(let ((dirname (expand-file-name
(if startdir startdir ".")))
(found nil) ; found is set as a flag to leave loop if we find it
(top nil)) ; top is set when we get
; to / so that we only check it once
; While we've neither been at the top last time nor have we found
; the file.
(while (not (or found top))
; If we're at / set top flag.
(if (string= (expand-file-name dirname) "/")
(setq top t))
; Check for the file
(if (file-exists-p (expand-file-name filename dirname))
(setq found t)
; If not, move up a directory
(setq dirname (expand-file-name ".." dirname))))
; return statement
(if found dirname nil)))
(setq compilation-scroll-output t)
(require 'compile)
(defun compile-next-makefile ()
(interactive)
(let* ((default-directory (or (upward-find-file "Makefile") "."))
(compile-command (concat "cd " default-directory " && make -j4 test")))
(compile compile-command)))
(defun my-cedet-hook ()
(local-set-key [(control return)] 'semantic-ia-complete-symbol)
(local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
(local-set-key "\C-c>" 'semantic-complete-analyze-inline)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle))
(add-hook 'c-mode-common-hook 'my-cedet-hook)
(global-set-key "\C-cc" 'compile-next-makefile)
(global-set-key [f11] 'dabbrev-expand)
(define-key esc-map [f12] 'dabbrev-completion)
(global-set-key "\C-m" 'newline-and-indent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment