Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Custom indentation in Emacs Vhdl-mode

 
Thread Tools Search this Thread
Old 01-11-2007, 03:01 PM   #1
Default Custom indentation in Emacs Vhdl-mode


Hello!
I hope some emacs guru can give me a tip on this
My organization requires that the following indentation is used in this
particular section of the code:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

Can I customize vhdl-mode to beautify like that to me?
The problem is that those 4 lines all return the same value in
"Syntactic Info" ( = statement), so I have no clue if what I want is
possible.

Any ideas?

Thanks,
Hugo



Hugo
  Reply With Quote
Old 01-11-2007, 03:18 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
Hugo wrote:
> Hello!
> I hope some emacs guru can give me a tip on this
> My organization requires that the following indentation is used in this
> particular section of the code:
>
> library ieee;
> use ieee.std_logic_1164.all;
> use ieee.std_logic_unsigned.all;
> use ieee.std_logic_arith.all;
>
> Can I customize vhdl-mode to beautify like that to me?


yes

> Any ideas?


I see that you also posted this to gun.emacs.help.
You will get an answer there.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 01-11-2007, 04:11 PM   #3
Ben Jones
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
"Mike Treseler" <> wrote in message
news:...
>
> I see that you also posted this to gun.emacs.help.
> You will get an answer there.


Surely mixing Emacs and firearms is a bad idea? Or did the editor wars just
escalate while I wasn't looking?

-Ben-




Ben Jones
  Reply With Quote
Old 01-11-2007, 04:54 PM   #4
Andy
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
I think that must be forum for frustrated, suicidal emacs users...

Andy


Ben Jones wrote:
> "Mike Treseler" <> wrote in message
> news:...
> >
> > I see that you also posted this to gun.emacs.help.
> > You will get an answer there.

>
> Surely mixing Emacs and firearms is a bad idea? Or did the editor wars just
> escalate while I wasn't looking?
>
> -Ben-




Andy
  Reply With Quote
Old 01-11-2007, 07:04 PM   #5
Mike Treseler
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
Ben Jones wrote:
> "Mike Treseler" <> wrote in message
> news:...
>> I see that you also posted this to gun.emacs.help.
>> You will get an answer there.

>
> Surely mixing Emacs and firearms is a bad idea?


Maybe not.
It passed the spell checker

-- Mike Treseler

"And I swear that I don't have a gnu."


Mike Treseler
  Reply With Quote
Old 01-12-2007, 01:19 PM   #6
Brian Drummond
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
On 11 Jan 2007 07:01:27 -0800, "Hugo" <> wrote:

>Hello!
>I hope some emacs guru can give me a tip on this
>My organization requires that the following indentation is used in this
>particular section of the code:
>
>library ieee;
> use ieee.std_logic_1164.all;
> use ieee.std_logic_unsigned.all;
> use ieee.std_logic_arith.all;
>
>Can I customize vhdl-mode to beautify like that to me?


This is the obvious place for a script to delete the last two lines and
replace them with " use ieee.numeric_std;"

- Brian


Brian Drummond
  Reply With Quote
Old 01-12-2007, 03:43 PM   #7
Mike Treseler
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
Brian Drummond wrote:
> On 11 Jan 2007 07:01:27 -0800, "Hugo" <> wrote:
>
>> Hello!
>> I hope some emacs guru can give me a tip on this
>> My organization requires that the following indentation is used in this
>> particular section of the code:
>>
>> library ieee;
>> use ieee.std_logic_1164.all;
>> use ieee.std_logic_unsigned.all;
>> use ieee.std_logic_arith.all;
>>
>> Can I customize vhdl-mode to beautify like that to me?

>
> This is the obvious place for a script to delete the last two lines and
> replace them with " use ieee.numeric_std;"


That's a positive twist for the editor wars.
While a macro to do a complete synopsys2numeric
is intractable, one to simply start on the
right foot by inserting

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

should not be difficult, and might
make for more interesting questions here.

I'll do such an emacs function
and will collect and post
any email contributions I get
in the next week for your favorite editor.

-- Mike Treseler




Mike Treseler
  Reply With Quote
Old 01-12-2007, 04:46 PM   #8
Ben Jones
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode

"Mike Treseler" <> wrote in message
news:...
> While a macro to do a complete synopsys2numeric
> is intractable, one to simply start on the
> right foot by inserting
>
> library ieee;
> use ieee.std_logic_1164.all;
> use ieee.numeric_std.all;
>
> should not be difficult, and might
> make for more interesting questions here.


I know that when using CVS, and presumably other source code control
systems, it is possible to create custom scripts that refuse a check-in if
the file does not conform to certain rules. It would be good to have such a
rule for VHDL that would barf when presented with ieee.std_logic_unsigned
and friends.

Cheers,

-Ben-

....as for the editor wars, I am mostly in favour of gnu control. Although
most people in this newsgroup would be quick to defend our right to bear
ARMs...





Ben Jones
  Reply With Quote
Old 01-12-2007, 05:05 PM   #9
Hugo
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
So, any ideas on how to indent the use's relative to "library ieee" ? I
know it's pretty silly thing...

The only way I know to accomplish that would be a post-beautifier
function that fixes those lines.. but this sounds rather ugly...

Tks,
Hugo

Mike Treseler escreveu:

> Brian Drummond wrote:
> > On 11 Jan 2007 07:01:27 -0800, "Hugo" <> wrote:
> >
> >> Hello!
> >> I hope some emacs guru can give me a tip on this
> >> My organization requires that the following indentation is used in this
> >> particular section of the code:
> >>
> >> library ieee;
> >> use ieee.std_logic_1164.all;
> >> use ieee.std_logic_unsigned.all;
> >> use ieee.std_logic_arith.all;
> >>
> >> Can I customize vhdl-mode to beautify like that to me?

> >
> > This is the obvious place for a script to delete the last two lines and
> > replace them with " use ieee.numeric_std;"

>
> That's a positive twist for the editor wars.
> While a macro to do a complete synopsys2numeric
> is intractable, one to simply start on the
> right foot by inserting
>
> library ieee;
> use ieee.std_logic_1164.all;
> use ieee.numeric_std.all;
>
> should not be difficult, and might
> make for more interesting questions here.
>
> I'll do such an emacs function
> and will collect and post
> any email contributions I get
> in the next week for your favorite editor.
>
> -- Mike Treseler




Hugo
  Reply With Quote
Old 01-12-2007, 05:51 PM   #10
Mike Treseler
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode
Hugo wrote:
> So, any ideas on how to indent the use's relative to "library ieee" ? I
> know it's pretty silly thing...
>
> The only way I know to accomplish that would be a post-beautifier
> function that fixes those lines.. but this sounds rather ugly...


Since I hijacked your thread, here's an idea.

Yes. If you look at the source for vhdl-beautify-buffer you will
see that it is pretty tightly wound. I would write a
wrapper function called vhdl-align-use that would
call beautify then find the first USE, insert three spaces, etc.
Something like:

(defun align-use () "Indent vhdl use clauses"
(vhdl-beautify-buffer)
(beginning-of-buffer)
;;code to search for "use" lines and insert three spaces goes here.
)


Mike Treseler
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an external software from VHDL? And how to interface VHDL with JAVA? becool_nikks Software 0 03-06-2009 07:08 PM
Help on auto conversion from Matlab to vhdl on filter design hardheart Hardware 0 12-07-2007 09:19 AM
flexible recording mode SS DVD Video 1 06-28-2005 11:15 PM
Safe Mode doesn't work, Normal mode does bobG A+ Certification 15 07-16-2004 01:50 PM
Safe Mode doesn't work, Normal mode does bobG A+ Certification 0 07-06-2004 11:57 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46