qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: PATCH: 1/7: Extend 'info vnc' output to show client


From: Mike Day
Subject: [Qemu-devel] Re: PATCH: 1/7: Extend 'info vnc' output to show client
Date: Wed, 18 Feb 2009 16:10:01 -0500
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On 15/02/09 11:43 +0000, Daniel P. Berrange wrote:
> On Fri, Feb 13, 2009 at 12:30:59PM -0600, Anthony Liguori wrote:
> > Daniel P. Berrange wrote:
> > >+
> > >+/*
> > >+ * Local variables:
> > >+ *  c-indent-level: 4
> > >+ *  c-basic-offset: 4
> > >+ *  tab-width: 8
> > >+ * End:
> > >+ */
> > >  
> > 
> > I'd prefer you not add this randomly in a patch.
> 
> Sorry, I added this to all the files I touched as QEMU's indentation rules
> don't match the default emacs & emacs will thus mess up all the whitespace.
> That said vnc.c already has alot of inconsistent whitespace :-( I'll strip
> this chunk out of future patches before submission.

Jimmy Xenidis helped me solve this problem automatically using the
following e-lisp. Put it in your custom.el or a file sourced by it. It
will automatically set the indent, offset, and tab width for you based
on the path of the file you are editing. The example below has styles
for Linux and Xen. You simply need to extrapolate and add another
style for Qemu.


;; xen c-style 
;; Jimmy Xenidis <address@hidden>

(defconst xen-style
  '( "bsd"
     (c-basic-offset . 4)
     (indent-tabs-mode . nil)
     (tab-width . 4)
     (label . 1)
    )
  "Xen C Programming Style")
(c-add-style "xen" xen-style t)

(defconst linux-c-style
        '( "K&R"
        (c-basic-offset . 8)
        (indent-tabs-mode . t)
        (tab-width . 8)
        )
"Linux CodingStyle")
(c-add-style "linux" linux-c-style t)


(defun my-c-mode-hooks ()
  "Look at auto-c-mode-alist to decide on the c style mode"
  (save-excursion
    (let ((name  (file-name-sans-versions buffer-file-name))
          (alist auto-c-mode-alist)
          (mode nil))
      (while (and (not mode) alist)
        (if (string-match (car (car alist)) name)
            (if (and (consp (cdr (car alist)))
                     (nth 2 (car alist)))
                (progn
                  (setq mode (car (cdr (car alist)))
                        name (substring name 0 (match-beginning 0))
                        keep-going t))
              (setq mode (cdr (car alist))
                    keep-going nil)))
        (setq alist (cdr alist)))
      (c-set-style mode))))
        

(setq c-style-variables-are-local-p t)
(setq auto-c-mode-alist
  '(
        ("/linux"                                   . "linux")
        ("/xen"                                     . "xen")
    (""                                         . "bsd")))

(add-hook 'c-mode-hook 'my-c-mode-hooks)



-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc




reply via email to

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