emacs - c++ mode irony mode
authorPeng Li <seudut@gmail.com>
Sun, 31 Jul 2016 09:52:10 +0000 (17:52 +0800)
committerPeng Li <seudut@gmail.com>
Sun, 31 Jul 2016 09:52:10 +0000 (17:52 +0800)
emacs.d/config.org

index 387b480..ce1075c 100644 (file)
@@ -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