Instead of removing auto-newline, control it via a variable

This commit is contained in:
Codruț Constantin Gușoi 2018-05-15 23:54:03 +03:00
parent 33192a05e2
commit 4219842f98
4 changed files with 21 additions and 1 deletions

View File

@ -13,6 +13,7 @@
- [[#company-clang-and-flycheck][Company-clang and flycheck]]
- [[#rtags-configuration][RTags configuration]]
- [[#enable-google-set-c-style][Enable google-set-c-style]]
- [[#newlines][Newlines]]
- [[#key-bindings][Key Bindings]]
- [[#formatting-clang-format][Formatting (clang-format)]]
- [[#rtags][RTags]]
@ -131,6 +132,16 @@ set that up like this:
c-c++-enable-google-newline t)
#+END_SRC emacs-lisp
** Newlines
You can enable the =Auto-newline= minor mode that automatically adds newlines
after certain characters by setting the =c-c++-enable-auto-newline= vairable.
#+BEGIN_SRC emacs-lisp
(c-c++ :variables
c-c++-enable-auto-newline t)
#+END_SRC emacs-lisp
* Key Bindings
| Key Binding | Description |

View File

@ -17,6 +17,9 @@
(defconst c-c++-mode-hooks '(c-mode-hook c++-mode-hook)
"Primary hooks of the `c-c++' layer.")
(defvar c-c++-enable-auto-newline nil
"If non nil then enables the `Auto-newline' minor mode.")
(defvar c-c++-enable-clang-support nil
"If non nil Clang related packages and configuration are enabled.")

View File

@ -9,6 +9,10 @@
;;
;;; License: GPLv3
(defun spacemacs//c-toggle-auto-newline ()
"Toggle auto-newline."
(c-toggle-auto-newline 1))
;; clang

View File

@ -43,7 +43,9 @@
:init
(progn
(add-to-list 'auto-mode-alist
`("\\.h\\'" . ,c-c++-default-mode-for-headers)))
`("\\.h\\'" . ,c-c++-default-mode-for-headers))
(when c-c++-enable-auto-newline
(add-hook 'c-mode-common-hook 'spacemacs//c-toggle-auto-newline)))
:config
(progn
(require 'compile)