[Freeciv-Dev] Re: [PATCH] slight optimisation at client/packhand.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, Aug 15, 2001 at 07:18:35PM -0700, Trent Piepho wrote:
> On Thu, 16 Aug 2001, Gaute B Strokkenes wrote:
> > This needs more spaces. Also, the && should be at the beginning of
> > the line, not the end.
>
> Other people (like me) like && at the end better, and it's more common that
> way in the code.
I also like the && at the end and some other things. However you have
to follow the rules. This is easy if you use emacs and something like:
---
(defun indent-region-by-shell-command () "some docu"
(interactive)
(setq orig-point-pos (point))
(setq my-start-marker (copy-marker (region-beginning)))
(setq my-end-marker (copy-marker (region-end)))
; If the region ends on a newline this leaves a newline after
; indention. Increase the end of region by one.
(goto-char (marker-position my-end-marker))
(if (eolp)
(set-marker my-end-marker (+ 1 (marker-position my-end-marker)))
())
(goto-char (marker-position my-start-marker))
(beginning-of-line)
(skip-chars-forward "\t ")
(setq braces-needed (/ (current-column) 2))
(beginning-of-line)
(setq start-of-braces-pos (point))
(setq num 0)
(while (< num braces-needed)
(insert "{")
(setq num (1+ num)))
(insert "\n")
(shell-command-on-region
start-of-braces-pos
(marker-position my-end-marker)
; get rid of 'Unexpected end of file' message
"indent -kr -i2 2>&1 | grep -v Unexpected" 1)
(goto-char start-of-braces-pos)
(while (not (eolp))
(delete-char 1))
(delete-char 1)
(goto-char (marker-position my-start-marker))
)
(global-set-key 'f2 'indent-region-by-shell-command)
---
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
A supercomputer is a computer running an endless loop in just a second
Message not available
- [Freeciv-Dev] Re: [PATCH] slight optimisation at client/packhand.c, Ross W. Wetmore, 2001/08/16
- [Freeciv-Dev] K&R style (was Re: [PATCH] slight optimisation ...), Justin Moore, 2001/08/17
- [Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...), Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...), Raimar Falke, 2001/08/17
- [Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...), Trent Piepho, 2001/08/17
|
|