From e45ca5d694a10922dd88a8222234cda00f424c59 Mon Sep 17 00:00:00 2001 From: Peng Li Date: Sun, 31 Jul 2016 17:52:10 +0800 Subject: [PATCH] emacs - c++ mode irony mode --- emacs.d/config.org | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/emacs.d/config.org b/emacs.d/config.org index 387b480..ce1075c 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -365,6 +365,7 @@ clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replac (org-indent-mode . "") ;; default is Fly (flyspell-mode . "") + (irony-mode . "I") ;; Major modes (lisp-interaction-mode . "λ") (hi-lock-mode . "") @@ -1700,11 +1701,50 @@ to call =compilation= interactively. #+END_SRC ** C & C++ +*** c/c++ style #+BEGIN_SRC emacs-lisp :tangle yes :results silent (setq c-default-style "stroustrup" c-basic-offset 4) #+END_SRC +*** flycheck +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package flycheck + :ensure t) +#+END_SRC +*** irony +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package irony + :ensure t + :config + (add-hook 'c++-mode-hook 'irony-mode) + (add-hook 'c-mode-hook 'irony-mode) + (add-hook 'objc-mode-hook 'irony-mode)) +#+END_SRC + +Install clang, on mac, it has =libclang.dylib=, but no develop headers. Install by =brew= +#+BEGIN_SRC sh + brew install llvm --with-clang +#+END_SRC + +then install irony searver, and =LIBCLANG_LIBRARY= and =LIBCLANG_INCLUDE_DIR= accordingly +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (irony-install-server) +#+END_SRC + +#+BEGIN_SRC sh + cmake -DLIBCLANG_LIBRARY\=/usr/local/Cellar/llvm/3.6.2/lib/libclang.dylib \ + -DLIBCLANG_INCLUDE_DIR=/usr/local/Cellar/llvm/3.6.2/include \ + -DCMAKE_INSTALL_PREFIX\=/Users/peli3/.emacs.d/irony/ \ + /Users/peli3/.emacs.d/elpa/irony-20160713.1245/server && cmake --build . --use-stderr --config Release --target install +#+END_SRC + +*** yasnippet +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package yasnippet + :ensure t) +#+END_SRC + * Compile Set the environments vairables in compilation mode #+BEGIN_SRC emacs-lisp :tangle yes :results silent -- 2.11.0