Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun my-c-and-c++-mode-hook ()
- "Added to c-mode-hook and c++-mode-hook (as defined by cc-mode.el). NOTE:
- This hook is designed to be used with both C and C++ files. To distinguish
- the two, test the value of the symbol major-mode against 'c-mode or 'c++-mode."
- (local-set-key (kbd "TAB") 'tab-to-tab-stop)
- (setq indent-tabs-mode nil) ;; Replace tabs with spaces.
- (let ((my-style (assoc-string "franl" c-style-alist 'ignore-case)))
- ;; First, delete my custom formatting style from c-style-alist.
- (if my-style
- (setq c-style-alist (delete my-style c-style-alist)))
- ;; Next, add my custom style. We do this so re-executing this hook
- ;; updates c-style-alist to my latest definition of this style.
- (add-to-list 'c-style-alist
- `("franl"
- (c-basic-offset . ,tab-width)
- (c-comment-only-line-offset . (0 . 0))
- (c-double-slash-is-comments-p . t)
- (c-echo-syntactic-information-p . nil)
- (c-electric-pound-behavior . (alignleft))
- (c-indent-comments-syntactically-p . t)
- (c-hanging-comment-ender-p . nil)
- (c-recognize-knr-p . nil)
- (c-offsets-alist . ((substatement-open . 0)
- (brace-list-open . 0)
- (inline-open . 0)
- ;;(c . 1)
- (arglist-close . ++)))))
- (c-set-style "franl"))
- )
- (add-hook 'c++-mode-hook 'my-c-and-c++-mode-hook)
- (add-hook 'c-mode-hook 'my-c-and-c++-mode-hook)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement