I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

  1. #+TITLE: C/C++
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle cc.el :comments org
  5. #+PROPERTY: header-args:shell :tangle no
  6. #+PROPERTY: header-args :results silent :eval no-export :comments org
  7. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  8. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  9. #+begin_quote
  10. The goal of C++ is productivity, this comes in many ways, but the language is designed to aid you as much as possible whiole hindering you as little as possible with arbitrary rules or requirements.
  11. -- Bruce Eckel, Thinking in C++[fn:1]
  12. #+end_quote
  13. * Setup
  14. Make sure all of the required components are installed, and the ~lsp~ and ~dap~ modules have loaded before loading this module.
  15. #+begin_src shell
  16. RUN apt install -y gcc gdb ccls libstdc++
  17. #+end_src
  18. * Config
  19. Use the ~ccls~[fn:2] language server, and the respective Emacs package to interact with the server inside of Emacs. Load the ~babel~ language module and add structure templates for creating C/C++ code blocks inside ~org-mode~.
  20. #+begin_src emacs-lisp
  21. (use-package ccls
  22. :hook ((c-mode c++-mode objc-mode cuda-mode) .
  23. (lambda ()
  24. (require 'ccls)
  25. (lsp-deferred)))
  26. :config (add-to-list 'org-structure-template-alist '("cc" . "src C"))
  27. (add-to-list 'org-structure-template-alist '("cpp" . "src C++"))
  28. (org-babel-do-load-languages 'org-babel-load-languages '((C . t))))
  29. #+end_src
  30. * Footnotes
  31. [fn:1] https://chrishayward.xyz/notes/thinking-in-cpp/
  32. [fn:2] https://github.com/MaskRay/ccls