qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Add astyle option file for code formatting


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] Add astyle option file for code formatting
Date: Mon, 19 Sep 2011 10:01:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Anthony Liguori <address@hidden> writes:

[...]
> FWIW, this is what I use with emacs:
>
> (c-add-style "qemu"
>         '("stroustrup"
>                 (indent-tabs-mode . nil)
>                 (c-basic-offset   . 4)
>                 (tab-width . 8)
>         )
>         nil) ; t = set this style, nil = don't

Here's my configuration (excuse liberal use of sledgehammer):

(setq c-initialization-hook
      (lambda()
        (setcar (member '(other . "gnu") c-default-style)
                (cons 'other "stroustrup"))))
(set-default 'c-recognize-knr-p nil)
(setq c-electric-pound-behavior '(alignleft))

(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  (c-mode)
  (c-set-style "K&R")
  (setq tab-width 8)
  (setq indent-tabs-mode t)
  (setq c-basic-offset 8))

(setq auto-mode-alist
      (cons '("/linux.*\\.[ch]\\'" . linux-c-mode)
            auto-mode-alist))

;; avoid tabs for some projects
(defun my-choose-tabs ()
  (let ((fname (buffer-file-name)))
    (and fname (string-match "/qemu" fname)
         (setq indent-tabs-mode nil))))
(add-hook 'after-change-major-mode-hook 'my-choose-tabs)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]