How can I use this emacs style in my emacs?
And how can I format all my existing code using this style?
How can I use this emacs style in my emacs?
And how can I format all my existing code using this style?
Quoting the documentation embedded as comments in the linked file:
;; Provides the google C/C++ coding style. You may wish to add
;; `google-set-c-style' to your `c-mode-common-hook' after requiring this
;; file. For example:
;;
;; (add-hook 'c-mode-common-hook 'google-set-c-style)
What this means is that you should copy the google-c-style.el
file somewhere
Emasc will find it (in your ~/.emacs.d
directory, for example). Then add the
following lines in your init file:
(require 'google-c-style)
(add-hook 'c-mode-common-hook 'google-set-c-style)
As to formatting existing code using this style, in any given buffer you can use
If you have a whole lot of open buffers, you can use ibuffer
to automate
reindenting all of them:
ibuffer
RET : open the buffers list(indent-region (point-min) (point-max))
RET : reindent
all marked buffers