;;; package — Summary
(require ‘package)
;;(setq package-archives ‘((“melpa” . “http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/”)))
;;(add-to-list ‘package-archives
;; ‘(“melpa” . “http://melpa.org/packages/”) t)
(add-to-list ‘package-archives ‘(“melpa-stable” . “https://stable.melpa.org/packages/”))
(package-initialize)
(when (not package-archive-contents) (package-refresh-contents))
;;(unless (package-installed-p ‘use-package) (package-install ‘use-package))
;(require ‘use-package)
;(setq use-package-always-ensure t)
;;(use-package irony
;; :defer t
;; :diminish irony-mode
;; :init
;; (add-hook ‘c++-mode-hook ‘irony-mode-when-supported)
;; (add-hook ‘c-mode-hook ‘irony-mode-when-supported)
;; :config
;; (irony-cdb-autosetup-compile-options))
(add-to-list ‘load-path “~/_emacs/custom”)
;;(require ‘setup-ggtags)
;;(require ‘setup-cedet)
(setq emacs_list_dir “~/_emacs/”)
(add-to-list ‘load-path emacs_list_dir)
;;(add-to-list ‘load-path “~/_emacs/ecb”)
(add-to-list ‘load-path “~/_emacs/emacs-eclim”)
(add-to-list ‘load-path “~/_emacs/icicles”)
(add-to-list ‘load-path “~/_emacs/CodePilot”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/common”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/speedbar”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/eieio”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/semantic”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/semantic/bovine”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/ede”)
;;(add-to-list ‘load-path “~/_emacs/cedet-1.1/srecode”)
(add-to-list ‘load-path “~/_emacs/yasnippet”)
(add-to-list ‘load-path “~/_emacs/fuzzy-el”)
(add-to-list ‘load-path “~/_emacs/popup-el”)
(add-to-list ‘load-path “~/_emacs/auto-complete”)
(add-to-list ‘load-path “~/_emacs/company-mode”)
(add-to-list ‘load-path “~/_emacs/auto-complete-clang”)
(add-to-list ‘load-path “~/_emacs/pos-tip”)
(add-to-list ‘load-path “~/_emacs/window-numbering”)
(add-to-list ‘load-path “~/_emacs/highlight-parentheses”)
;;(add-to-list ‘load-path “~/_emacs/python”)
;;(add-to-list ‘load-path “~/_emacs/git-emacs”)
(add-to-list ‘load-path “~/_emacs/emacs-htmlize”)
(add-to-list ‘load-path “~/_emacs/imenu-list”)
;;(global-srecode-mirror-mode 1) ; Enable template insertion menu
;;(require ‘setup-editing)
;;(require ‘setup-general)
;;(require ‘ecb)
;;(require ‘ecb-autoloads)
(require ‘auto-complete)
(require ‘auto-complete-config)
(require ‘auto-complete-clang)
;;(require ‘cedet)
(require ‘cc-mode)
;;(require ‘c++-mode)
(require ‘semantic)
(require ‘srecode)
(require ‘yasnippet)
(require ‘highlight-parentheses)
(require ‘semantic/ia)
(require ‘window-numbering)
(require ‘pos-tip)
(require ‘ggtags)
(require ‘sr-speedbar)
(require ‘ido)
(require ‘htmlize)
(require ‘imenu-list)
(add-hook ‘c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode'c++-mode)
(ggtags-mode 1))))
;;(global-ede-mode 1) ; Enable the Project management system
(ggtags-mode 1)
;;(defconst cedet-user-include-dirs
;; (list “..” “../include” “../inc” “../common” “../public”
;; “../..” “../../include” “../../inc” “../../common” “../src” “../../src”))
;;(requrie ‘semantic-c nil ‘noerror)
;;(let ((include-dirs cedet-user-include-dirs))
;; (mapc (lambda (dir)
;; (semantic-add-system-include dir ‘c++-mode)
;; (semantic-add-system-include dir ‘c-mode))
;; include-dirs))
(require ‘semantic-c nil ‘noerror)
(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))
(semantic-mode 1)
(global-semantic-idle-summary-mode t)
(global-semantic-idle-scheduler-mode t)
;; smart complete function or other words
;; -1 off, 1 on
(global-semantic-idle-completions-mode 1)
;;(global-semantic-idle-local-symbol-highlight-mode 1)
(global-semantic-mru-bookmark-mode)
;;(global-semantic-highlight-fuc-mode)
;;(global-semanticdb-minor-mode)
;;(semantic-highlight-fuc-mode t)
;;(semantic-highlight-edits-mode)
;;(semantic-load-enable-code-helpers) ; Enable prototype help and smart completion
;; To enable more advanced functionality for name completion, etc
(require ‘semantic/ia)
(require ‘semantic/bovine/gcc)
(yas-global-mode 1)
(add-hook ‘prog-mode-hook #’highlight-parentheses-mode)
;;(add-hook ‘prog-mode-hook #’highlight-parentheses-color-update)
;;(add-hook ‘minibuffer-setup-hook #’highlight-parentheses-minibuffer-setup)
;;(global-highlight-parentheses-mode t)
(electric-pair-mode 1)
(global-linum-mode)
(setq column-number-mode 1)
(window-numbering-mode 1)
(add-to-list ‘ac-dictionary-directories “~/_emacs/auto-complete/dict”)
;;; conflict with ycmd
;;(setq ac-quick-help-prefer-pos-tip t)
(setq ac-use-quick-help t)
(setq ac-fuzzy-enable t)
;;(setq ac-menu-height 12)
;;(set-face-background ‘ac-candidate-face “lightgray”)
;;(set-face-underline ‘ac-candidate-face “darkgray”)
;;(set-face-background ‘ac-candidate-face “steelblue”)
;;; for mac use: gcc -v -E -x c – search for c header files path
;; gcc -v -E -x c++ – search for c++ header files path
(defun my-ac-config()
(setq ac-clang-flags
(mapcar (lambda (item) (concat "-I" item))
(split-string "
/usr/include/c++/9
/usr/include/x86_64-linux-gnu/c++/9
/usr/include/c++/9/backward
/usr/lib/gcc/x86_64-linux-gnu/9/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
/home/dhong/source/git/bgw/fota-update/include
/home/dhong/source/git/bgw/fota-update/inc/
/home/dhong/source/git/bgw/fota-update/src/
/home/dhong/source/git/bgw/fota-update/thirdpary/
/home/dhong/source/github/boost_1_78_0/boost
“))))
(setq-default ac-sources ‘(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
;;(add-hook ‘c-mode-common-hook ‘ac-cc-mode-setup)
;;(add-hook ‘c++-mode-hook ‘ac-cc-mode-setup)
;;(add-hook ‘auto-complete-mode-hook ‘ac-common-setup)
;;(global-auto-complete-mode t)
(defun my-ac-cc-mode-setup ()
(setq ac-sources (append ‘(ac-source-clang ac-source-yasnippet) ac-sources))
)
;;; conflict with ycmd mode
;; — (add-hook ‘c-mode-common-hook ‘my-ac-cc-mode-setup)
;; ac-source-gtags
;; — (my-ac-config) ;;; for c/c++
(ac-config-default)
(global-auto-complete-mode t)
(define-key ac-mode-map (kbd “M-/”) ‘auto-complete)
;;; company-mode confict with ycmd mode
(autoload ‘company-mode “company” nil t)
(yas-global-mode 1)
;;(add-hook ‘c-mode-hook ‘(lambda () (company-mode)))
;;(add-hook ‘c++-mode-hook ‘(lambda () (company-mode)))
(global-set-key [(control tab)] ‘company-complete-common)
;;; load clang
(require ‘auto-complete-clang)
;;; add c-mode and c++-mode hook, enable aut-complete clang extension
(defun ac-cc-mode-setup()
(make-local-variable ‘ac-auto-start)
(setq ac-auto-start nil)
(setq ac-sources (append ‘(ac-source-clang ac-source-yasnippet) ac-sources)))
(add-hook ‘c-mode-hook ‘ac-cc-mode-setup)
(add-hook ‘c++-mode-hook ‘ac-cc-mode-setup)
(my-ac-config) ;;; for c/c++
;; high light current line
(global-hl-line-mode 1)
;;(imenu-list-smart-toggle)
;;(load “base.el”)
;;(load “cyexpand.el”)
;;(load “cykbd.el”)
;;(load “addon.el”)
;;(load “cycode.el”)
;; (display-time)
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq default-lime-spaceing 4)
(setq default-fill-column 60)
(setq kill-ring-max 200)
(global-font-lock-mode 1)
(transient-mark-mode t)
(setq visible-bell t)
(fset ‘yes-or-no-p ‘y-or-n-p)
(setq resize-mini-windows nil)
(setq enable-recursive-minibuffers t)
;; set default work directory
(setq default-directory “~”)
;; gdb-ui configuration
(setq gdb-many-windows t)
;;(load-library “multi-gud.el”)
;;(load-library “multi-gdb-ui.el”)
;;(require ‘ecb-autoloads)
;;(setq ecb-quto-activate t)
;;(setq ecb-tip-of-the-day nil)
;;(require ‘lsp)
;;(require ‘lsp-clients)
;; YASnippet config
(require ‘yasnippet)
(yas/initialize)
(yas/load-directory “~/_emacs/yasnippet/snippets”)
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
(defun my-indent-or-complete()
(interactive)
(if (looking-at "\\>")
(hippie-expand nil)
(indent-for-tab-command))
)
(global-set-key [(control tab)] ‘my-indent-or-complete)
;;(define-key c-mode-base-map [(meta ?/)] ‘semantic-ia-complete-symbol-menu)
(autoload ‘senator-try-expand-semantic “senator”)
(setq hippie-expand-try-functions-list
'(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)
(global-set-key [f1] ‘manual-entry)
(global-set-key [C-f1] ‘info)
(global-set-key [f3] ‘grep-find)
(global-set-key [M-f3] ‘kill-this-buffer)
(global-set-key [(f4)] ‘speedbar-get-focus)
;;;(global-set-key [C-f4] ‘ecb-activate)
(global-set-key [f5] ‘tool-bar-mode)
(global-set-key [C-f5] ‘menu-bar-mode)
(global-set-key [f6] ‘gdb)
(defun open-eshell-other-buffer ()
"Open eshell in other buffer"
(interactive)
(split-window-vertically)
(eshell))
(defun my-eshell-clear-buffer ()
"Eshell clear buffer."
(interactive)
(let ((eshell-buffer-maximum-lines 0))
(eshell-truncate-buffer)))
(global-set-key [(f8)] ‘open-eshell-other-buffer)
(global-set-key [C-f8] ‘eshell)
(global-set-key [S-f8] ‘my-eshell-clear-buffer)
(global-set-key [f12] ‘semantic-ia-fast-jump)
(global-set-key [C-f12] ‘list-bookmarks)
;; shift-f12 jump back
;;
;; for ecb window switch
;;(global-set-key [M-left] ‘windmove-left)
;;(global-set-key [M-right] ‘windmove-right)
;;(global-set-key [M-up] ‘windmove-up)
;;(global-set-key [M-down] ‘windmove-down)
;; hide or show ecb window
;;(global-set-key [f11] ‘ecb-hide-ecb-windows)
;;(global-set-key [S-f11] ‘ecb-show-ecb-windows)
;; close current window alt+4
(global-set-key (kbd “M-4”) ‘delete-window)
;;(global-set-key (kbd “M-4”) ‘kill-this-buffer)
;; close other window, alt+1
(global-set-key (kbd “M-1”) ‘delete-other-windows)
;; horizon split window, alt+2
(global-set-key (kbd “M-2”) ‘split-window-vertically)
;; horizontally split window, alt+3
(global-set-key (kbd “M-3”) ‘split-window-horizontally)
;; swithc to other window alt+0
(global-set-key (kbd “M-0”) ‘other-window)
;; display cache buffer
(global-set-key (kbd “M-5”) ‘display-buffer-name)
;; code setting
;;(require ‘coding-settings)
(defun save-all-buffer()
“Save all buffer.”
(interactive)
(dolist (buffer (buffer-list))
(save-buffer buffer)))
(defun kill-all-buffer()
“Kill all buffer.”
(interactive)
(save-all-buffer)
(dolist (buffer (buffer-list)) (kill-buffer buffer)))
(defun kill-other-buffer()
“Close all of other buffer.”
(interactive)
(save-all-buffer)
(dolist (buffer (delq (current-buffer) (buffer-list)))
(kill-buffer buffer)))
(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.
‘(ansi-color-names-vector
[“#242424” “#e5786d” “#95e454” “#cae682” “#8ac6f2” “#333366” “#ccaa8f” “#f6f3e8”])
‘(column-number-mode 1)
‘(custom-safe-themes
‘(“6b4f7bde1ce64ea4604819fe56ff12cda2a8c803703b677fdfdb603e8b1f8bcb” “28818b9b1d9e58c4fb90825a1b07b0f38286a7d60bf0499bc2dea7eea7e36782” “cb30d82b05359203c8378638dec5ad6e37333ccdda9dee8b9fdf0c902e83fad7” “5f4dfda04fbf7fd55228266c8aab73953d3087cea7fd06dd7f8ff1e4a497c739” “b8c5adfc0230bd8e8d73450c2cd4044ad7ba1d24458e37b6dec65607fc392980” “05d009b7979e3887c917ef6796978d1c3bbe617e6aa791db38f05be713da0ba0” “392f19e7788de27faf128a6f56325123c47205f477da227baf6a6a918f73b5dc” default))
‘(display-time-mode t)
‘(ecb-options-version “2.50”)
‘(ispell-dictionary nil)
‘(package-selected-packages
‘(magit flycheck-irony use-package material-theme company-dict company-anaconda company-ycmd flycheck-ycmd ycmd 0blayout color-theme-modern plantuml-mode anaconda-mode py-autopep8 elpy ivy company-fuzzy company-irony-c-headers company-irony irony company-native-complete modern-cpp-font-lock company cquery lsp-mode yasnippet imenu-list highlight-parentheses auto-complete))
‘(show-paren-mode t))
(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.
)
;;(display-line-number-mode-on)
;;(require ‘modern-cpp-font-lock)
;;(modern-c++-font-lock-global-mode t)
;; company keys
;;(with-eval-after-load ‘company
;; (define-key company-active-map (kbd “M-n”) nil)
;; (define-key company-active-map (kbd “M-p”) nil)
;; (define-key company-active-map (kbd “C-n”) #’company-select-next)
;; (define-key company-active-map (kbd “C-p”) #’company-select-previous))
;;(ido-mode t)
;; map command key to M on Mac os
;;if (system-is-mac)
;;(setq ns-command-modifier ‘meta)
;;(sr-speedbar-toggle)
;;(sr-speedbar-refresh)
(setq c-mode-hook
'(lambda()
(ggtags-mode 1)))
(setq c++-mode-hook
'(lambda()
(ggtags-mode 1)))
(setq org-startup-indented t)
(setq org-src-fontify-natively t)
(setq plantuml-jar-path “/Users/hongqian.dong/source/bin/plantuml.jar”)
(setq plantuml-default-exec-mode ‘jar)
(setq org-plantuml-jar-path (expand-file-name “/Users/hongqian.dong/source/bin/plantuml.jar”))
(setq plantuml-jar-path “/Users/hongqian.dong/source/bin/plantuml.jar”)
(setq plantuml-default-exec-mode ‘jar)
(setq org-plantuml-jar-path (expand-file-name “/Users/hongqian.dong/source/bin/plantuml.jar”))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; usage ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;#+begin_src plantuml :file my-diagram.png
;;;title Authentication Sequence
;;;Alice->Bob: Authentication Request
;;;note right of Bob: Bob thinks about it
;;;Bob->Alice: Authentication Response
;;;#+end_src
;;;export e.g. with C-c C-e h o
;;;
;;;Then you can edit a plantuml code block with plantuml-mode by hitting C-‘ while inside of the code block itself:
;;;
;;;#+BEGIN_SRC plantuml
;;; <hit C-c ‘ here to open a plantuml-mode buffer>
;;;#+END_SRC
;;;When in the plantuml-mode buffer you can then hit again C-‘ to return to the original org-mode document.
;;; https://github.com/skuro/plantuml-mode
;;;(add-to-list
;;; ‘org-src-lang-modes ‘(“plantuml” . plantuml))
(ivy-mode 1)
(setq auto-mode-alist
(cons '("CMakeLists.txt" . makefile-mode) auto-mode-alist))
;; auto add space after ,
(global-set-key (kbd “,”)
#'(lambda()
(interactive)
(insert ",")))
;; highlight-parentheses
(electric-pair-mode)
(show-paren-mode 1)
;;(setq show-paren-style ‘parenthesis)
(setq show-paren-style ‘expression)
;;(setq show-paren-style ‘mixed)
(global-highlight-parentheses-mode)
;; python-mode settings
(setq auto-mode-alist (cons ‘(“\.py$” . python-mode) auto-mode-alist))
(setq interpreter-mode-alist(cons ‘(“python” . python-mode)
interpreter-mode-alist))
;; path to the python interpreter, e.g.: ~rw/python31/bin/python3
(setq py-python-command “python3”)
(autoload ‘python-mode “python-mode” “Python editing mode.” t)
;; pymacs settings
;;(require ‘pycomplete)
;;(setq pymacs-python-command py-python-command)
;;(autoload ‘pymacs-load “pymacs” nil t)
;;(autoload ‘pymacs-eval “pymacs” nil t)
;;(autoload ‘pymacs-apply “pymacs”)
;;(autoload ‘pymacs-call “pymacs”)
;;(add-hook ‘python-mode-hook ‘anaconda-mode)
;;(add-hook ‘python-mode-hook ‘anaconda-eldoc-mode)
;;(defconst my-cc-style
;; ‘(“c++-mode”
;; (c-offsets-alist . ((innamespace . [0])))))
;;
;;(c-add-style “my-cc-mode” my-cc-style)
;;(defconst my-cc-style
;; ‘(“cc-mode”
;; (c-offsets-alist . ((innamespace . [0])))))
;;(c-add-style “my-cc-mode” my-cc-style)
(defun my-c-setup ()
(c-set-offset ‘innamespace [0]))
(add-hook ‘c++-mode-hook ‘my-c-setup)
;; C++ 代码格调设置
(defconst cobbcpp
‘(“linux” ; this is inheritance from the linux style
(c-basic-offset . 4)
(c-offsets-alist .
((innamespace . [0])))))
(c-add-style “cobbcpp” cobbcpp)
(defun CobbCppHook()
(c-set-style “cobbcpp”)
(setq indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)
(setq global-hl-line-mode t)
)
(add-hook ‘c++-mode-hook ‘CobbCppHook)
(add-hook ‘c-mode-hook ‘CobbCppHook)
;;(defconst ooo-c-style
;; ‘((c-backslash-column . 70)
;; (c-basic-offset . 4)
;; (c-cleanup-list scope-operator)
;; (c-comment-only-line-offset . 0)
;; (c-electric-pound-behavior)
;; (c-hungry-delete-key t)
;; (c-hanging-braces-alist
;; (brace-list-open)
;; (brace-entry-open)
;; (inexpr-class . +)
;; (innamespace . 0)))
;; “OOo Programming Style”)
;;(defun ooo-c-mode-common-hook ()
;; (c-add-style “ooo” ooo-c-style t)
;; (c-set-style “ooo”)
;; (c-set-offset ‘member-init-intro ‘++)
;; (setq tab-width 2)
;; (setq indent-tabs-mode nil) ;; use spaces instead of tabs
;; (c-toggle-auto-state 1)
;; (define-key c-mode-base-map “\C-m” ‘newline-and-indent)
;; )
;;(add-hook ‘c-mode-common-hook ‘ooo-c-mode-common-hook)
;;(add-hook ‘c++-mode-common-hook ‘000-c-mode-common-hook)
;; plant uml mode support
;; export e.g. with C-c C-e h o
;;(setq org-plantuml-jar-path (expand-file-name “/home/you/path/to/plantuml.jar”))
;;(add-to-list ‘org-src-lang-modes ‘(“plantuml” . plantuml))
;;(org-babel-do-load-languages ‘org-babel-load-languages ‘((plantuml . t)))
;; active Org-babel languages
;;(setq org-plantuml-jar-path
;; (expand-file-name “~/Documents/plantuml-1.2022.0.jar”))
(org-babel-do-load-languages
‘org-babel-load-languages
‘(;; other Babel languages
(plantuml . t)))
;;git-emacs
;;(require ‘git-emacs)
;; —————————————————————————–
;; setting font for mac system
;; —————————————————————————–
;; Setting English Font
;;(set-face-attribute
;; ‘default nil :font “Monaco 14”)
;; Chinese Font 配制中文字体
;;(dolist (charset ‘(kana han symbol cjk-misc bopomofo))
;; (set-fontset-font (frame-parameter nil ‘font)
;; charset
;; (font-spec :family “PingFang SC” :size 14)))
;; Note: you can chang “PingFang SC” to “Microsoft YaHei” or other fonts
;;; create a new layout (<prefix> C-c)
;;; switch layout (<prefix> C-b)
;;; kill the current layout (<prefix> C-k)
;;; the default prefix is (C-c C-l)
;;; change prefix: (0blayout-add-keybinding-with-prefix)
(0blayout-mode)
;;;;; ============================================== < for irony start >
;; 代码补全的配置
;; ===================================================
(require ‘company)
(require ‘irony)
(require ‘company-irony)
;;(add-hook ‘c++-mode-hook ‘company-mode)
;;(add-hook ‘c-mode-hook ‘company-mode)
;;(add-hook ‘c++-mode-hook ‘irony-mode)
;;(add-hook ‘c-mode-hook ‘irony-mode)
(add-hook ‘irony-mode-hook ‘irony-cdb-autosetup-compile-options)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
(setq company-dabbrev-downcase nil)
(add-to-list ‘company-backends ‘company-dabbrev)
(add-to-list ‘company-backends ‘company-dabbrev-code)
(add-to-list ‘company-backends ‘company-files)
(add-to-list ‘company-backends ‘company-semantic)
(add-to-list ‘company-backends ‘company-keywords)
(add-to-list ‘company-backends ‘company-irony)
(add-to-list ‘company-backends ‘company-gtags)
(add-to-list ‘company-backends ‘company-capf)
;;(require ‘company-c-headers)
;;(add-to-list ‘company-c-headers-path-system “/usr/include/c++/4.9.2/”)
;;(add-to-list ‘company-backends ‘company-c-headers)
(global-set-key (kbd “C-.”) ‘company-complete-common)
(setq company-text-icons-add-background t)
(setq company-text-icons-add-background t)
;; irony-mode
(add-hook ‘c++-mode-hook ‘irony-mode)
(add-hook ‘c-mode-hook ‘irony-mode)
;;(add-hook ‘objc-mode-hook ‘irony-mode)
(add-hook ‘irony-mode-hook ‘irony-cdb-autosetup-compile-options)
(use-package irony
:defer t
:diminish irony-mode
:init
;; (add-hook ‘c++-mode-hook ‘irony-mode-when-supported)
;; (add-hook ‘c-mode-hook ‘irony-mode-when-supported)
:config
(irony-cdb-autosetup-compile-options))
(use-package company-irony-c-headers
:after irony)
(use-package company-irony
:after (irony company-irony-c-headers)
:config
(add-to-list ‘company-backends ‘(company-irony-c-headers company-irony)))
;; 应用 M -n 和 M-p 抉择候选项
;;company 色彩设置
(defun theme-dark ()
(interactive)
(set-face-foreground ‘company-tooltip “#000”)
(set-face-background 'company-tooltip"#fff")
(set-face-foreground 'company-scrollbar-bg"#fff")
(set-face-background 'company-scrollbar-fg"#999")
)
;;;(theme-dark)
;;(wombat)
;;;; =============================================== < for irony end>
;;;;================================================= < for ycmd start >
(add-hook ‘after-init-hook #’global-company-mode)
(add-hook ‘after-init-hook #’global-flycheck-mode)
;;;; To use ycmd-mode in all supported modes
;;(require ‘ycmd)
;;(add-hook ‘after-init-hook #’global-ycmd-mode)
;;(ycmd-toggle-force-semantic-completion)
;;;; Specify how to run the server
;;(set-variable ‘ycmd-server-command ‘(“/usr/bin/python3” “/home/dhong/.emacs.d/ycmd/ycmd”))
;;;; Specify a global emacs configuration
;;(set-variable ‘ycmd-global-config “/home/dhong/.emacs.d/ycmd/ycmd/ycm_extra_conf.py”)
;;;; Completion framework
;;(require ‘company-ycmd)
;;(company-ycmd-setup)
;;(add-hook ‘after-init-hook #’global-company-mode)
;;;; Enable flycheck
;;(require ‘flycheck-ycmd)
;;(flycheck-ycmd-setup)
;;(add-hook ‘after-init-hook #’global-flycheck-mode)
;;;; Set always complete immediately
;;(setq company-idle-delay 0)
;;(set-variable ‘ycmd-startup-timeout 120)
;;(set-variable ‘ycmd-auto-trigger-semantic-completion t)
;;(set-variable ‘ycmd-force-semantic-completion t)
;;;;================================================== < for ycmd end >
;;(load-theme ‘jsc-light2 t)
;;(load-theme ‘jsc-dark t)
;; load theme solarized
;;(load-theme ‘solarized-lightt)
;;(load-theme ‘leuven)
;;(load-theme ‘material t)
;;; emacs server start automatically
;;; connect server with emacs client
;;; emacsclient
;;; start server in the bash: emacs –daemon
;;; start client: emacsclient -t -a “”
;;; “” means start server first, then connect to server
;;(server-start)
;; 代码折叠
(add-hook ‘c-mode-hook ‘hs-minor-mode)
(add-hook ‘c++-mode-hook ‘hs-minor-mode)
;;; python development setup
(elpy-enable)
;; Enable Flycheck
(when (require ‘flycheck nil t)
(setq elpy-modules (delq ‘elpy-module-flymake elpy-modules))
(add-hook ‘elpy-mode-hook ‘flycheck-mode))
;;; imenu-list
;;<enter>: goto entry under cursor, or toggle case-folding.
;;<space>: display entry under cursor, but Ilist buffer remains current
;;<mouse click>: same as <enter>
;;<tab>: expand/collapse subtree (hs-toggle-hiding)
;;f: same as <tab>
;;n: next line
;;p: previous line
;;g: manually refresh entries
;;q: quit window and disable imenu-list-minor-mode
(set-variable ‘imenu-list-position ‘left)
(set-variable ‘imenu-list-size 0.30)
(global-set-key (kbd “C-‘”) #’imenu-list-smart-toggle)
(global-set-key (kbd “C-;”) #’sr-speedbar-toggle)
;;; .emacs end here