Received: from eggs.gnu.org ([140.186.70.92]:40744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Ymu-00022N-AZ for qemu-devel@nongnu.org; Mon, 19 Sep 2011 04:01:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5Ymp-0001ZV-0x for qemu-devel@nongnu.org; Mon, 19 Sep 2011 04:01:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Ymo-0001Z3-QJ for qemu-devel@nongnu.org; Mon, 19 Sep 2011 04:01:06 -0400 From: Markus Armbruster References: <1315760411-26359-1-git-send-email-weil@mail.berlios.de> <4E734A0D.3010309@codemonkey.ws> Date: Mon, 19 Sep 2011 10:01:00 +0200 In-Reply-To: <4E734A0D.3010309@codemonkey.ws> (Anthony Liguori's message of "Fri, 16 Sep 2011 08:07:25 -0500") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] Add astyle option file for code formatting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori 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)