qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mike Day <ncmike@ncultra.org>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] Re: PATCH: 1/7: Extend 'info vnc' output to show client
Date: Wed, 18 Feb 2009 16:10:01 -0500	[thread overview]
Message-ID: <20090218211000.GA22487@silverwood.ncultra.org> (raw)
In-Reply-To: <20090215114312.GF4795@redhat.com>

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 <jimix@us.ibm.com>

(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

  parent reply	other threads:[~2009-02-18 21:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 14:53 [Qemu-devel] PATCH: 0/7: Support SASL authentication in VNC server Daniel P. Berrange
2009-02-12 15:01 ` [Qemu-devel] PATCH: 1/7: Extend 'info vnc' output to show client Daniel P. Berrange
2009-02-13 18:30   ` Anthony Liguori
2009-02-15 11:43     ` Daniel P. Berrange
2009-02-15 18:22       ` Anthony Liguori
2009-02-18 21:10       ` Mike Day [this message]
2009-02-12 15:02 ` [Qemu-devel] PATCH: 2/7: Push VncState struct into vnc.h Daniel P. Berrange
2009-02-14 22:09   ` Anthony Liguori
2009-02-15 11:43     ` Daniel P. Berrange
2009-02-12 15:02 ` [Qemu-devel] PATCH: 3/7: Split out VNC TLS auth code to separate file Daniel P. Berrange
2009-02-12 15:03 ` [Qemu-devel] PATCH: 4/7: Add SASL authentication extension to VNC Daniel P. Berrange
2009-02-12 15:03 ` [Qemu-devel] PATCH: 5/7: Include auth credentials in 'info vnc' Daniel P. Berrange
2009-02-12 15:04 ` [Qemu-devel] PATCH: 6/7: Support simple ACL for client authorization Daniel P. Berrange
2009-02-14 22:14   ` Anthony Liguori
2009-02-12 15:04 ` [Qemu-devel] PATCH: 7/7: Add external persistent ACL file Daniel P. Berrange
2009-02-14 22:16   ` Anthony Liguori
2009-02-15 11:28     ` Daniel P. Berrange
2009-02-12 15:43 ` [Qemu-devel] PATCH: 0/7: Support SASL authentication in VNC server Daniel P. Berrange
2009-02-14 22:17 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090218211000.GA22487@silverwood.ncultra.org \
    --to=ncmike@ncultra.org \
    --cc=aliguori@us.ibm.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).