FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-11-2007, 04:01 PM
Hugo
Guest
 
Posts: n/a
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

Reply With Quote
  #2 (permalink)  
Old 01-11-2007, 04:18 PM
Mike Treseler
Guest
 
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
Reply With Quote
  #3 (permalink)  
Old 01-11-2007, 05:11 PM
Ben Jones
Guest
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode

"Mike Treseler" <[email protected]> wrote in message
news:[email protected]..
>
> 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-


Reply With Quote
  #4 (permalink)  
Old 01-11-2007, 05:54 PM
Andy
Guest
 
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" <[email protected]> wrote in message
> news:[email protected]..
> >
> > 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-


Reply With Quote
  #5 (permalink)  
Old 01-11-2007, 08:04 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode

Ben Jones wrote:
> "Mike Treseler" <[email protected]> wrote in message
> news:[email protected]..
>> 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."
Reply With Quote
  #6 (permalink)  
Old 01-12-2007, 02:19 PM
Brian Drummond
Guest
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode

On 11 Jan 2007 07:01:27 -0800, "Hugo" <[email protected]> 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
Reply With Quote
  #7 (permalink)  
Old 01-12-2007, 04:43 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode

Brian Drummond wrote:
> On 11 Jan 2007 07:01:27 -0800, "Hugo" <[email protected]> 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


Reply With Quote
  #8 (permalink)  
Old 01-12-2007, 05:46 PM
Ben Jones
Guest
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode


"Mike Treseler" <[email protected]> wrote in message
news:[email protected]..
> 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...



Reply With Quote
  #9 (permalink)  
Old 01-12-2007, 06:05 PM
Hugo
Guest
 
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" <[email protected]> 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


Reply With Quote
  #10 (permalink)  
Old 01-12-2007, 06:51 PM
Mike Treseler
Guest
 
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.
)
Reply With Quote
  #11 (permalink)  
Old 01-12-2007, 06:58 PM
haws
Guest
 
Posts: n/a
Default Re: Custom indentation in Emacs Vhdl-mode

Ok, thanks! I guess that solution will do!

I thought I'd have to change the syntactic meaning of "use", but
vhdl-mode is kinda complicated (20k lines), so I probably don't want to
mess there anyway

Mike Treseler escreveu:

> 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.
> )


Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Emacs vhdl-mode question [email protected] VHDL 5 06-30-2006 07:23 PM
Tcl DC Mode for Emacs Reto Zimmermann VHDL 2 06-20-2006 01:39 PM
Tcl DC Mode for Emacs Reto Zimmermann Verilog 2 06-20-2006 01:39 PM
UCF-mode for Emacs [email protected] FPGA 2 04-27-2006 07:25 PM
emacs vhdl-mode Rick Jackson VHDL 10 11-30-2005 01:09 PM


All times are GMT +1. The time now is 01:57 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved