Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code Indentation

32 views
Skip to first unread message

bk...@hotmail.com

unread,
Dec 29, 2008, 10:47:32 AM12/29/08
to
Ever wanted to indent a code that you got from somebody else. I
created some scripts for that, which I would like to share as free
stuff.
Be glad to get comments.
http://bknpk.no-ip.biz/indent/indent.html

Andreas Ehliar

unread,
Dec 29, 2008, 7:34:21 AM12/29/08
to
On 2008-12-29, bk...@hotmail.com <bk...@hotmail.com> wrote:
> Ever wanted to indent a code that you got from somebody else. I

I'll just share another way to do this as well if you happen to have
verilog-mode installed in emacs:

emacs --batch file.v --eval "(progn (indent-region (point-min) (point-max) nil) (save-buffer))"

(I found the command together with some related emacs batch mode
discussion at http://community.livejournal.com/emacs/10446.html)


As for your perl implementation of indent:
I looked at your perl script but I'm afraid that I don't have
that many comments for you as I'm quite satisfied with verilog-mode
in emacs. However, if I understand things correctly you haven't
considered functions in Verilog when indenting. Might be something
you want to consider if you care about functions.


/Andreas

bek...@gmail.com

unread,
Dec 29, 2008, 11:57:43 PM12/29/08
to
On 29 דצמבר, 14:34, Andreas Ehliar <ehliar-nos...@isy.liu.se> wrote:
> On 2008-12-29, bk...@hotmail.com <bk...@hotmail.com> wrote:
>
> > Ever wanted to indent a code that you got from somebody else. I
>
> I'll just share another way to do this as well if you happen to have
> verilog-mode installed in emacs:
>
> emacs --batch file.v --eval "(progn (indent-region (point-min) (point-max) nil) (save-buffer))"
>
> (I found the command together with some related emacs batch mode
> discussion athttp://community.livejournal.com/emacs/10446.html)

>
> As for your perl implementation of indent:
> I looked at your perl script but I'm afraid that I don't have
> that many comments for you as I'm quite satisfied with verilog-mode
> in emacs. However, if I understand things correctly you haven't
> considered functions in Verilog when indenting. Might be something
> you want to consider if you care about functions.
>
> /Andreas

The script does not come onstead of emacs or vi set tabstop option.
Sometimes there is no indentation at all or it is badly done by more
than one person and it is very annoying looking on that code.

This is script is not complete but at least it makes all code look a
like and use spaces as opposed to tabs used by editors.

Marcus Harnisch

unread,
Dec 30, 2008, 10:30:27 AM12/30/08
to
bek...@gmail.com writes:

> The script does not come onstead of emacs or vi set tabstop option.
> Sometimes there is no indentation at all or it is badly done by more
> than one person and it is very annoying looking on that code.
>
> This is script is not complete but at least it makes all code look a
> like and use spaces as opposed to tabs used by editors.

AFAIK, Emacs' verilog-mode doesn't use tabs. Even if it did, just
change the command to:

,----


| emacs --batch file.v --eval "(progn (indent-region (point-min) \

| (point-max) nil) (untabify (point-min) (point-max)) (save-buffer))"
`----

There are just too many ways to make Verilog code annoying to look
at. Indentation is just one of these.

Hmm, just wondering if there is a way to make Verilog code *not*
annoying to look at anyway. Ah yes, there's verilog2vhdl }:^)

Happy New Year
Marcus

--
note that "property" can also be used as syntaxtic sugar to reference
a property, breaking the clean design of verilog; [...]

(seen on http://www.veripool.com/verilog-mode_news.html)

0 new messages