Project specific C indent
This commit is contained in:
8
init.el
8
init.el
@@ -22,6 +22,9 @@
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(auth-source-save-behavior nil)
|
||||
'(custom-safe-themes
|
||||
(quote
|
||||
("6145e62774a589c074a31a05dfa5efdf8789cf869104e905956f0cbd7eda9d0e" "9955cc54cc64d6c051616dce7050c1ba34efc2b0613d89a70a68328f34e22c8f" "1d079355c721b517fdc9891f0fda927fe3f87288f2e6cc3b8566655a64ca5453" "aea30125ef2e48831f46695418677b9d676c3babf43959c8e978c0ad672a7329" default)))
|
||||
'(haskell-process-auto-import-loaded-modules t)
|
||||
'(haskell-process-log t)
|
||||
'(haskell-process-suggest-remove-import-lines t)
|
||||
@@ -29,6 +32,7 @@
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(counsel-projectile swiper colemak-evil evil all-the-icons use-package rich-minority projectile mode-icons magit-find-file haskell-mode gruvbox-theme fill-column-indicator evil-magit counsel)))
|
||||
'(safe-local-variable-values (quote ((c-indent-level . 4))))
|
||||
'(send-mail-function (quote smtpmail-send-it)))
|
||||
|
||||
(custom-set-faces
|
||||
@@ -37,10 +41,10 @@
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(linum ((t (:underline nil))))
|
||||
'(mode-line ((t (:background "gray11" :foreground "#b8b8b8" :box nil :family "Iosevka Term" :height 100))))
|
||||
'(mode-line ((t (:background "#282c34" :foreground "#b8b8b8" :box nil :family "Iosevka Term" :height 100))))
|
||||
'(mode-line-buffer-id ((t (:foreground "#a1b56c" :family "Iosevka Term" :height 100))))
|
||||
'(mode-line-highlight ((t (:foreground "#ba8baf" :box nil :weight bold :family "Iosevka Term" :height 100))))
|
||||
'(mode-line-inactive ((t (:background "#282828" :foreground "#585858" :box nil :underline nil :family "Iosevka Term" :height 100))))
|
||||
'(mode-line-inactive ((t (:background "#282c34" :foreground "#585858" :box nil :underline nil :family "Iosevka Term" :height 100))))
|
||||
'(term-color-black ((t (:foreground "#525252"))))
|
||||
'(term-color-blue ((t (:foreground "#33ddff"))))
|
||||
'(term-color-cyan ((t (:foreground "#196f80"))))
|
||||
|
||||
@@ -7,16 +7,6 @@
|
||||
(autoload 'ghc-debug "ghc" nil t)
|
||||
(add-hook 'haskell-mode-hook (lambda () (ghc-init)))
|
||||
(add-to-list 'exec-path "~/.cabal/bin")
|
||||
;; (add-to-list
|
||||
;; 'default-frame-alist
|
||||
;; '(font . "Iosevka Term 10"))
|
||||
;; (set-frame-font
|
||||
;; "Iosevka Term 10")
|
||||
;; (add-to-list
|
||||
;; 'default-frame-alist
|
||||
;; '(font . "envypn 15"))
|
||||
;; (set-frame-font
|
||||
;; "envypn 15")
|
||||
(add-to-list
|
||||
'default-frame-alist
|
||||
'(font . "Iosevka Term 10"))
|
||||
@@ -26,6 +16,7 @@
|
||||
'(buffer-file-name "%f"
|
||||
(dired-directory dired-directory "%b")))
|
||||
(fringe-mode '(0 . 0))
|
||||
(setq enable-local-variables nil)
|
||||
(setq inhibit-startup-screen t)
|
||||
(setq vc-follow-symlinks t)
|
||||
(setq inhibit-compacting-font-caches 1)
|
||||
@@ -49,22 +40,52 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
|
||||
(add-to-list 'auto-mode-alist
|
||||
'("\\.\\(p\\(?:k[bg]\\|ls\\)\\|sql\\)\\'" . plsql-mode))
|
||||
;; (setq auto-mode-alist
|
||||
;; (append
|
||||
;; '(("\\.\\(p\\(?:k[bg]\\|ls\\)\\|sql\\)\\'" . plsql-mode))
|
||||
;; auto-mode-alist))
|
||||
(defun my-web-mode-hook ()
|
||||
"Hooks for Web mode."
|
||||
(setq web-mode-markup-indent-offset 2)
|
||||
(setq web-mode-code-indent-offset 2)
|
||||
(setq web-mode-css-indent-offset 2))
|
||||
(add-hook 'web-mode-hook 'my-web-mode-hook)
|
||||
|
||||
(setq-default indent-tabs-mode t)
|
||||
(setq-default tab-width 8)
|
||||
(setq-default c-default-style "linux"
|
||||
c-basic-offset 2)
|
||||
(defvaralias 'c-basic-offset 'tab-width)
|
||||
(defvaralias 'cperl-indent-level 'tab-width)
|
||||
(defun c-lineup-arglist-tabs-only (ignored)
|
||||
"Line up argument lists by tabs, not spaces"
|
||||
(let* ((anchor (c-langelem-pos c-syntactic-element))
|
||||
(column (c-langelem-2nd-pos c-syntactic-element))
|
||||
(offset (- (1+ column) anchor))
|
||||
(steps (floor offset c-basic-offset)))
|
||||
(* (max steps 1)
|
||||
c-basic-offset)))
|
||||
|
||||
(add-hook 'c-mode-common-hook
|
||||
(lambda ()
|
||||
(c-add-style
|
||||
"libvirt"
|
||||
'((indent-tabs-mode . nil)
|
||||
(c-basic-offset . 4)
|
||||
(c-indent-level . 4)
|
||||
(c-offsets-alist
|
||||
(label . 1))))
|
||||
;; Add kernel style
|
||||
(c-add-style
|
||||
"linux-tabs-only"
|
||||
'("linux"
|
||||
(c-offsets-alist
|
||||
(arglist-cont-nonempty
|
||||
c-lineup-gcc-asm-reg
|
||||
c-lineup-arglist-tabs-only))))))
|
||||
|
||||
(defun my-c-mode-hooks ()
|
||||
(let ((bname (buffer-file-name)))
|
||||
(cond
|
||||
((string-match "libvirt/" bname) (c-set-style "libvirt"))
|
||||
((string-match "datastructures/" bname) (c-set-style "linux"))
|
||||
((string-match "linux/" bname) (c-set-style "linux-tabs-only"))
|
||||
)))
|
||||
|
||||
(add-hook 'c-mode-hook 'my-c-mode-hooks)
|
||||
|
||||
(setq backup-by-copying t ; don't clobber symlinks
|
||||
backup-directory-alist
|
||||
'(("." . "~/.saves")) ; don't litter my fs tree
|
||||
@@ -84,7 +105,6 @@
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
(setq vc-mode 1)
|
||||
(display-time-mode 1)
|
||||
(display-battery-mode 1)
|
||||
|
||||
(defun remove-elc-on-save ()
|
||||
"If you're saving an elisp file, likely the .elc is no longer valid."
|
||||
@@ -103,11 +123,6 @@
|
||||
(add-hook 'term-mode-hook (lambda ()
|
||||
(setq-local global-hl-line-mode nil)))
|
||||
|
||||
;;(setq auto-mode-alist
|
||||
;; (append
|
||||
;; '(("\\.\\(p\\(?:k[bg]\\|ls\\)\\|sql\\)\\'" . plsql-mode))
|
||||
;; auto-mode-alist))
|
||||
|
||||
(defadvice term-handle-exit
|
||||
(after term-kill-buffer-on-exit activate)
|
||||
(kill-buffer))
|
||||
|
||||
Reference in New Issue
Block a user