-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from tonycurtis/emacs
Initial drop of UCX indentation setup for GNU Emacs
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
;; Usage: | ||
;; add our tweaks to c-mode | ||
;; The basic indentation | ||
;; (add-hook 'c-mode-hook 'tc-indent-config) | ||
;; | ||
;; Warn when we're getting close to exceeding line length | ||
;; (add-hook 'c-mode-hook 'tc-mark-80-column-rule) | ||
;; | ||
;; On-the-fly indentation of lines | ||
;; (add-hook 'c-mode-hook 'electric-indent-mode) | ||
;; | ||
;; Indent opened lines immediately rather than TABbing across | ||
;; (add-hook 'c-mode-hook 'tc-c-nl-indent) | ||
;; | ||
|
||
(require 'cc-mode) | ||
(require 'whitespace) | ||
|
||
(defun tc-mark-80-column-rule () | ||
"Highlight lines that are about to get too long" | ||
(setq whitespace-line-column 78) | ||
(setq whitespace-style '(face empty tabs lines-tail trailing)) | ||
(whitespace-mode) | ||
) | ||
|
||
(defun tc-indent-config () | ||
"Set the required layout" | ||
(setq c-basic-offset 4 | ||
tab-width 4 | ||
indent-tabs-mode nil) | ||
) | ||
|
||
;; add our tweaks to c-mode | ||
(defun tc-c-nl-indent () | ||
"Make newline also immediately indent next line" | ||
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent) | ||
) | ||
|
||
;; Other people can now require me | ||
(provide 'ucx-style) |