Emacs's perfect c ++ Automatic completion

Source: Internet
Author: User
1. The latest code of CVS cedet, and the completion of code 1.04 is very slow.
  1. CVS-Z3-D: pserver: anonymous@cedet.cvs.sourceforge.net:/cvsroot/cedet Co-P cedet


2. Run the command line

  1. Touch 'Find-name "makefile" '// (note the left quotation marks)
  2. Make Bootstrap

3. Run the command line

  1. G ++-e-v-P dummy. cpp

Many header files will be found. Dummy. cpp is an empty file, and then

4. Add in. emacs

  1. (Eval-after-load "semantic-c"; E:/Emacs/home is my $ home
  2. '(Dolist (D (list "/usr/include/C ++/4.1.0"
  3. "/Usr/include/C ++/4.1.0/x86_64-suse-linux"
  4. "/Usr/include/C ++/4.1.0/backward"
  5. "/Usr/local/include"
  6. "/Usr/lib64/GCC/x86_64-suse-linux/4.1.0/include"
  7. "/Usr/lib64/GCC/x86_64-suse-linux/4.1.0/.../x86_64-suse-linux/include"
  8. "/Usr/include"
  9. ))
  10. (Semantic-add-system-include D )))
  11. ; Configure the storage directory of the semantic analysis result file below. Note that this directory must be created by yourself.
  12. (Setq semanticdb-default-save-directory
  13. (Expand-file-name "~ /. Emacs. d/semanticdb "))
  14. ; The directory of the header file has been defined, and some small definitions are made for C-mode:
  15. (Add-hook 'C-mode-common-hook
  16. '(Lambda ()
  17. (Require 'cedet)
  18. (EDE-minor-mode t)
  19. ; The following three are ranked by the degree of robustness applicable to machines, with the lowest requirement for machines. Select one from three.
  20. ; (Semantic-load-enable-gaudy-code-helpers)
  21. ; (Semantic-load-enable-code-helpers)
  22. (Semantic-load-enable-minimum-features)
  23. ; The three buttons are bound to be enabled as per your preferences. Except for the first button that can be modified as your favorite, the other two buttons have no modification significance.
  24. ; Anyway, the major supplement relies on semantic-complete-analyze-inline. In the future, it will be used to steal and cheat.
  25. ; Semantic-complete-Self-inset is also called semantic-complete-analyze-inline.
  26. (Local-set-Key (KBD "M-/") 'semantic-complete-analyze-inline)
  27. (Local-set-key "." 'semantic-complete-Self-insert)
  28. (Local-set-key ">" 'semantic-complete-Self-insert)
  29. (C-toggle-auto-hungry-state 1)
  30. (C-set-style "K & R ")))

OK. You can try it in the code. M-/completion, or input. Or-> after the struct, the code is prompted, which is very convenient.

Reference:
Http://www.linuxforum.net/forum/showflat.php? Cat = & board = Vim & number = 687565 & page = 0 & view = collapsed & SB = 5 & O = 0 & fpart =

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.