Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (server-start)
- (add-to-list 'load-path "~/.emacs.d/")
- (load-file "~/.emacs.d/cedet-1.0/common/cedet.el")
- (semantic-load-enable-excessive-code-helpers)
- ;;(semantic-load-enable-semantic-debugging-helpers)
- (setq senator-minor-mode-name "SN")
- (setq semantic-imenu-auto-rebuild-directory-indexes nil)
- (global-srecode-minor-mode 1)
- (global-semantic-mru-bookmark-mode 1)
- (require 'auto-complete)
- (global-auto-complete-mode t)
- ;; (ac-flyspell-workaround)
- (setq path-to-ctags "/usr/local/share/ctags/TAGS") ;; <- your ctags path here
- (defun create-tags (dir-name)
- "Create tags file."
- (interactive "DDirectory: ")
- (shell-command
- (format "%s -f %s/TAGS -e -R %s" path-to-ctags dir-name (directory-file-name dir-name)))
- )
- (require 'semantic-decorate-include)
- ;; gcc setup
- (require 'semantic-gcc)
- ;; smart complitions
- (require 'semantic-ia)
- (semantic-add-system-include "/usr/include/pcl-1.3/" 'c++-mode)
- (semantic-add-system-include "/usr/include/eigen3/" 'c++-mode)
- (setq-mode-local c-mode semanticdb-find-default-throttle
- '(project unloaded system recursive))
- (setq-mode-local c++-mode semanticdb-find-default-throttle
- '(project unloaded system recursive))
- (setq-mode-local erlang-mode semanticdb-find-default-throttle
- '(project unloaded system recursive))
- (require 'eassist)
- ;; customisation of modes
- (defun alexott/cedet-hook ()
- (local-set-key [(control return)] 'semantic-ia-complete-symbol-menu)
- (local-set-key "\C-c?" 'semantic-ia-complete-symbol)
- ;;
- (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
- (local-set-key "\C-c=" 'semantic-decoration-include-visit)
- (local-set-key "\C-cj" 'semantic-ia-fast-jump)
- (local-set-key "\C-cq" 'semantic-ia-show-doc)
- (local-set-key "\C-cs" 'semantic-ia-show-summary)
- (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
- )
- ;; (add-hook 'semantic-init-hooks 'alexott/cedet-hook)
- (add-hook 'c-mode-common-hook 'alexott/cedet-hook)
- (add-hook 'lisp-mode-hook 'alexott/cedet-hook)
- (add-hook 'scheme-mode-hook 'alexott/cedet-hook)
- (add-hook 'emacs-lisp-mode-hook 'alexott/cedet-hook)
- (add-hook 'erlang-mode-hook 'alexott/cedet-hook)
- (defun alexott/c-mode-cedet-hook ()
- ;; (local-set-key "." 'semantic-complete-self-insert)
- ;; (local-set-key ">" 'semantic-complete-self-insert)
- (local-set-key "\C-ct" 'eassist-switch-h-cpp)
- (local-set-key "\C-xt" 'eassist-switch-h-cpp)
- (local-set-key "\C-ce" 'eassist-list-methods)
- (local-set-key "\C-c\C-r" 'semantic-symref)
- )
- (add-hook 'c-mode-common-hook 'alexott/c-mode-cedet-hook)
- ;; hooks, specific for semantic
- (defun alexott/semantic-hook ()
- ;; (semantic-tag-folding-mode 1)
- (imenu-add-to-menubar "TAGS")
- )
- (add-hook 'semantic-init-hooks 'alexott/semantic-hook)
- (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.
- '(fancy-splash-image nil)
- '(global-semantic-show-parser-state-mode t nil (semantic-util-modes))
- '(global-semantic-tag-folding-mode t nil (semantic-util-modes))
- '(inhibit-startup-screen t)
- '(semantic-self-insert-show-completion-function (lambda nil (semantic-ia-complete-symbol-menu (point)))))
- ;; gnu global support
- (require 'semanticdb-global)
- (semanticdb-enable-gnu-global-databases 'c-mode)
- (semanticdb-enable-gnu-global-databases 'c++-mode)
- ;; ctags
- ;; (require 'semanticdb-ectag)
- ;; (defvar semantic-ectag-program "/usr/bin/ctags-exuberant")
- ;; (semantic-load-enable-primary-exuberent-ctags-support)
- ;;
- (semantic-add-system-include "/usr/include/pcl-1.3/" 'c++-mode)
- (defun recur-list-files (dir re)
- "Returns list of files in directory matching to given regex"
- (when (file-accessible-directory-p dir)
- (let ((files (directory-files dir t))
- matched)
- (dolist (file files matched)
- (let ((fname (file-name-nondirectory file)))
- (cond
- ((or (string= fname ".")
- (string= fname "..")) nil)
- ((and (file-regular-p file)
- (string-match re fname))
- (setq matched (cons file matched)))
- ((file-directory-p file)
- (let ((tfiles (recur-list-files file re)))
- (when tfiles (setq matched (append matched tfiles)))))))))))
- (defun c++-setup-boost (boost-root)
- (when (file-accessible-directory-p boost-root)
- (let ((cfiles (recur-list-files boost-root "\\(config\\|user\\)\\.hpp")))
- (dolist (file cfiles)
- (add-to-list 'semantic-lex-c-preprocessor-symbol-file file)))))
- ;;
- ;;(global-semantic-idle-tag-highlight-mode 1)
- ;;; ede customization
- (require 'semantic-lex-spp)
- (global-ede-mode t)
- (ede-enable-generic-projects)
- ;; maven-based projects
- ;;(ede-maven2-project "clojure-hadoop" :file "~/projects/clojure-hadoop/pom.xml")
- ;; cpp-tests project definition
- (setq cpp-tests-project
- (ede-cpp-root-project "cpp-tests"
- :file "~/projects/lang-exp/cpp/CMakeLists.txt"
- :system-include-path '("/usr/include/"
- boost-base-directory)
- :local-variables (list
- (cons 'compile-command 'alexott/gen-cmake-debug-compile-string)
- )
- ))
- (defun alexott/ede-get-local-var (fname var)
- "fetch given variable var from :local-variables of project of file fname"
- (let* ((current-dir (file-name-directory fname))
- (prj (ede-current-project current-dir)))
- (when prj
- (let* ((ov (oref prj local-variables))
- (lst (assoc var ov)))
- (when lst
- (cdr lst))))))
- ;; setup compile package
- ;; TODO: allow to specify function as compile-command
- (require 'compile)
- (setq compilation-disable-input nil)
- (setq compilation-scroll-output t)
- (setq mode-compile-always-save-buffer-p t)
- (defun alexott/compile ()
- "Saves all unsaved buffers, and runs 'compile'."
- (interactive)
- (save-some-buffers t)
- (let* ((r (alexott/ede-get-local-var
- (or (buffer-file-name (current-buffer)) default-directory)
- 'compile-command))
- (cmd (if (functionp r) (funcall r) r)))
- ;; (message "AA: %s" cmd)
- (set (make-local-variable 'compile-command) (or cmd compile-command))
- (compile compile-command)))
- (global-set-key [f9] 'alexott/compile)
- ;;
- (defun alexott/gen-std-compile-string ()
- "Generates compile string for compiling CMake project in debug mode"
- (let* ((current-dir (file-name-directory
- (or (buffer-file-name (current-buffer)) default-directory)))
- (prj (ede-current-project current-dir))
- (root-dir (ede-project-root-directory prj))
- )
- (concat "cd " root-dir "; make -j2")))
- ;;
- (defun alexott/gen-cmake-debug-compile-string ()
- "Generates compile string for compiling CMake project in debug mode"
- (let* ((current-dir (file-name-directory
- (or (buffer-file-name (current-buffer)) default-directory)))
- (prj (ede-current-project current-dir))
- (root-dir (ede-project-root-directory prj))
- (subdir "")
- )
- (when (string-match root-dir current-dir)
- (setf subdir (substring current-dir (match-end 0))))
- (concat "cd " root-dir "Debug/" "; make -j3")))
- (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.
- '(linum ((t (:inherit (shadow default)))))
- '(scroll-bar ((t nil))))
- (require 'color-theme)
- (color-theme-initialize)
- (color-theme-subtle-hacker)
- (global-set-key [?\M-1] 'tmm-menubar)
- (column-number-mode t)
- ;; Python stuff starts here!
- (setq python-python-command "ipython")
- (load-file "~/.emacs.d/ipython.el")
- (load-file "~/.emacs.d/anything.el")
- (load-file "~/.emacs.d/anything-ipython.el")
- (load-file "~/.emacs.d/anything-show-completion.el")
- (require 'python-mode)
- (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
- (require 'ipython)
- (require 'anything)
- (require 'anything-ipython)
- (when (require 'anything-show-completion nil t)
- (use-anything-show-completion 'anything-ipython-complete
- '(length initial-pattern)))
- (require 'comint)
- (define-key comint-mode-map (kbd "M-") 'comint-next-input)
- (define-key comint-mode-map (kbd "M-") 'comint-previous-input)
- (define-key comint-mode-map [down] 'comint-next-matching-input-from-input)
- (define-key comint-mode-map [up] 'comint-previous-matching-input-from-input)
- (setq pylookup-dir "~/.emacs.d/pylookup/")
- (add-to-list 'load-path pylookup-dir)
- ;; load pylookup when compile time
- (eval-when-compile (require 'pylookup))
- ;; set executable file and db file
- (setq pylookup-program (concat pylookup-dir "/pylookup.py"))
- (setq pylookup-db-file (concat pylookup-dir "/pylookup.db"))
- ;; to speedup, just load it on demand
- (autoload 'pylookup-lookup "pylookup"
- "Lookup SEARCH-TERM in the Python HTML indexes." t)
- (autoload 'pylookup-update "pylookup"
- "Run pylookup-update and create the database at `pylookup-db-file'." t)
- (setq TeX-auto-save t)
- (setq TeX-parse-self t)
- (setq-default TeX-master nil)
- (tool-bar-mode -1)
- (global-linum-mode 1)
- ;; TeX stuff
- (load "auctex.el" nil t t)
- (load "preview-latex.el" nil t t)
- ;; (require 'ac-math)
- ;; (add-to-list 'ac-modes 'latex-mode) ; make auto-complete aware of {{{latex-mode}}}
- ;; (defun ac-latex-mode-setup () ; add ac-sources to default ac-sources
- ;; (setq ac-sources
- ;; (append '(ac-source-math-unicode ac-source-math-latex ac-source-latex-commands)
- ;; ac-sources)
- ;; (ac-flyspell-workaround)
- ;; (flyspell-mode t)
- ;; )
- ;; )
- ;; (add-hook 'LaTeX-mode-hook 'ac-latex-mode-setup)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement