Emacs: Refactor programming/c++.

This commit is contained in:
tastytea 2020-06-23 02:30:38 +02:00
parent a8f4b8a101
commit 1f78527f04
1 changed files with 35 additions and 45 deletions

View File

@ -1,6 +1,6 @@
;;; c++.el --- C++ settings. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-06-15T21:30:37+0200>
;; Time-stamp: <2020-06-23T02:30:23+0200>
;;; Commentary:
@ -56,31 +56,28 @@
(use-package cc-mode
:defer 2
:commands (cc-mode)
:config (progn
(c-add-style ; Construct own coding style definition.
"tastytea"
'("bsd"
(c-basic-offset . 4) ; Indent with 4 spaces.
(c-offsets-alist
. ((innamespace . [0]) ; Don't indent in namespaces.
(statement-cont . (c-lineup-assignments
c-lineup-string-cont
c-lineup-cascaded-calls
c-lineup-class-decl-init-after-brace
+))) )))
(c-add-style
"tastytea-legacy" ; For old code.
'("bsd"
(c-basic-offset . 4)))
:config
(c-add-style ; Construct own coding style definition.
"tastytea"
'("bsd"
(c-basic-offset . 4) ; Indent with 4 spaces.
(c-offsets-alist . ((innamespace . [0]) ; Don't indent in namespaces.
(statement-cont . (c-lineup-assignments
c-lineup-string-cont
c-lineup-cascaded-calls
c-lineup-class-decl-init-after-brace
+))) )))
(c-add-style
"tastytea-legacy" ; For old code.
'("bsd"
(c-basic-offset . 4)))
(defun my/get-builddir ()
(if (member 'projectile-mode minor-mode-list)
(concat (projectile-project-root) "build")
nil))
:custom
(c-default-style "tastytea")
)
(defun my/get-builddir ()
(if (member 'projectile-mode minor-mode-list)
(concat (projectile-project-root) "build")
nil)))
:custom (c-default-style "tastytea"))
;; Highlighting, indentation and documentation for CMake.
;; The CMake ebuild installs and activates the mode.
@ -92,10 +89,7 @@
;; CMake reference.
(use-package eldoc-cmake
:after cmake-mode
:hook
(cmake-mode . eldoc-cmake-enable)
)
:hook (cmake-mode . eldoc-cmake-enable))
(use-package gdb-mi
:straight nil ; Inbuilt.
@ -105,25 +99,21 @@
;; Extra highlighting.
(use-package modern-cpp-font-lock
:diminish modern-c++-font-lock-mode
:hook
(c++-mode . modern-c++-font-lock-mode)
)
:hook (c++-mode . modern-c++-font-lock-mode))
(use-package find-file
:defer 2
:custom
(cc-search-directories '("." ; Set directories for ff-find-other-file.
"../src"
"../include"
"../../src"
"../../include"
"../src/*"
"../include/*"
"../../src/*"
"../../include/*"
"/usr/include"
"/usr/local/include/*"))
)
:custom (cc-search-directories '("." ; Set directories for ff-find-other-file.
"../src"
"../include"
"../../src"
"../../include"
"../src/*"
"../include/*"
"../../src/*"
"../../include/*"
"/usr/include"
"/usr/local/include/*")))
(when (executable-find "clang-format")
(use-package clang-format