[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Results of: [VOTE] New space-before-parens style

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2006-02-13 06:17:53 CET

On Mon, 12 Feb 2006 kfogel@collab.net wrote:

> There are a lot of unrequested changes like that. I'm not sure how to
> make them go away. And there doesn't seem to be a way to tell
> 'indent' to use no defaults and just do exactly what was requested.
>
> Does this mean we're going to have to do it all by hand? It might be
> easier to patch the indent sources to do what we want... Let's see:
>
> Anyone got any better ideas, before I go further down that road?
>
I experimented with indent, but gave up pretty early. The following elisp
function seems to do the job pretty well:

(defun reformat ()
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward "(" (point-max) t)
    (progn
      (goto-char (match-beginning 0))
      (save-excursion
        (goto-char (- (point) 1))
        (if (and (looking-at " ") (not (c-in-literal)) (c-on-identifier))
            (progn
              (delete-char 1)
              ; We're on the paren again.
              (let ((start (point)))
                (forward-sexp 1)
                (indent-region start (point) nil)))))
      (goto-char (+ (point) 1)))
    ))

It doesn't work in svn_error_codes.h, but that can be handled separately.
Improvement suggestions welcome.

Regards,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Feb 13 06:18:21 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.