TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: StykFacE on December 14, 2011, 09:57:00 AM

Title: General question about VLIDE and Coding
Post by: StykFacE on December 14, 2011, 09:57:00 AM
Hello to all. I just have a general question that I've actually always been curious about. I was wondering how y'all handle "code formatting" when you are deep into programming? I know when I'm monkeying around with simple code, or modifying another person's program to fit my needs, I notice that when I Tab over it doesn't look as spaced out or clean as some (or most) of the main programmers I see on this board and the CADTutor.net site.

Is this a manual process to literally Spacebar over "x" amount of character space to get it how y'all like it? Or is there a super secret method that guys like me don't know about?

Here is a screenshot of a program that I have. I made it about 4 years ago but half of it was helped by someone over at CADTutor.net IIRC. I'm starting to get around better with the VLIDE, for instance I know how to use the "Load Active Edit Window" and "Load Selection", which is nice when I'm monkeying around with things.
(http://dl.dropbox.com/u/4989089/Images/swamp/2011-12-14/vlide.png)


Just trying to learn from the pro's is all. Thanks in advance.  :kewl:
Title: Re: General question about VLIDE and Coding
Post by: ronjonp on December 14, 2011, 10:04:14 AM
CTRL-ALT-F  :-)

Title: Re: General question about VLIDE and Coding
Post by: MP on December 14, 2011, 10:05:20 AM
I don't use the vlide, I use Textpad or UltraEdit 99% of them time, and in both the tab key is smart (tab and shift tab) -- formatting so ez I really don't have to put much effort or thought into it. It would actually be harder for me to write unformatted code because it hurts my eyes so much. (http://www.theswamp.org/screens/mp/facepalm.gif)
Title: Re: General question about VLIDE and Coding
Post by: alanjt on December 14, 2011, 10:10:47 AM
CTRL-ALT-F  :-)
Or click on one of the two triangle icons.
First will format everything, second will only format selected content.
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 14, 2011, 10:18:39 AM
Yep, the "triangle" buttons like attached. Just remember to setup your Tools --> Environment Options --> Visual LISP Format Options to something you like. I prefer not having those default ;_ end of ... comments added all over the place.

About the tab not being a smart-tab, that's sometimes a blessing in disguise. But I hear what MP's saying! In some instances I hate the way VS formats the code as soon as you close the brackets, but usually that can be fixed through some settings.

Where VLIDE (for me) falls far short of others is with folding and code completion / intellisense.
Title: Re: General question about VLIDE and Coding
Post by: alanjt on December 14, 2011, 10:21:00 AM
irneb, what are you using to make your screenshots?
Title: Re: General question about VLIDE and Coding
Post by: dgorsman on December 14, 2011, 10:23:47 AM
I've gotten annoyed at tab-formatting so often, I set tabs to insert spaces rather than tab characters.  Seems to work out better that way.  That way, when its opened on other computers it doesn't matter what their tab "width" is set to.
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 14, 2011, 10:29:52 AM
Oh, and BTW your comments will be formatted stragely. There's a trick in VLIDE where it depends on the 1st few characters of a comment how it will get formatted. E.g.

I'm using XNView to do screen captures. Just because I'm used to it.
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 14, 2011, 10:32:09 AM
I've gotten annoyed at tab-formatting so often, I set tabs to insert spaces rather than tab characters.  Seems to work out better that way.  That way, when its opened on other computers it doesn't matter what their tab "width" is set to.
+1
Title: Re: General question about VLIDE and Coding
Post by: alanjt on December 14, 2011, 10:32:24 AM
I'm using XNView to do screen captures. Just because I'm used to it.
Cool. I don't mind using print screen and pasting into paint/photoshop, but an actual screen capture to file would be nice. Thanks.

Sorry for the thread jack. Resume regular programming.
Title: Re: General question about VLIDE and Coding
Post by: nivuahc on December 14, 2011, 10:42:14 AM
I'm using XNView to do screen captures. Just because I'm used to it.
Cool. I don't mind using print screen and pasting into paint/photoshop, but an actual screen capture to file would be nice. Thanks.

Sorry for the thread jack. Resume regular programming.

 :angel: cough (http://www.gadwin.com/printscreen/)
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 14, 2011, 10:46:40 AM
Cool. I don't mind using print screen and pasting into paint/photoshop, but an actual screen capture to file would be nice. Thanks.
Great! I've simply un-learned that habit since one of the keyboards I use goes into that "special M$ keys" at the top and then the Print Screen button doesn't do what it's supposed to.

The XNView thingy isn't actually only used for screen captures though. It's much more comprehensive than that. E.g. I tend to export to PNG from PS and then use XN to batch print. The prints come out 10x faster that way, strange how PS's printing hogs the printer for minutes before anything starts to happen - especially if there's transparencies involved. But not so when exporting to JPG/PNG.

Back on topic: I would definitely love to see a VLIDE update. Perhaps it would be possible to simply use Scintilla for this, it would allow even Intellisense - though not type based due to Lisp being a flexible typed language. But I can't see why it would be impossible to have with showing only function calls directly following an open parenthesis, while only showing variables and other symbols directly following a space. It would make mistypes a lot less prevalent.

And for huge LSP files, folding is an absolute MUST! And then just for fun  :lmao: I'd also adore being able to use regular expressions in Search & Replace, not just the usual wild-card matching.
Title: Re: General question about VLIDE and Coding
Post by: alanjt on December 14, 2011, 10:51:29 AM
I'm using XNView to do screen captures. Just because I'm used to it.
Cool. I don't mind using print screen and pasting into paint/photoshop, but an actual screen capture to file would be nice. Thanks.

Sorry for the thread jack. Resume regular programming.

 :angel: cough (http://www.gadwin.com/printscreen/)
Very nice. Thanks. :)
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 14, 2011, 10:55:08 AM
:angel: cough (http://www.gadwin.com/printscreen/)
BTW, if you have Vista/W7, the new Snipping tool also does a great job: http://windows.microsoft.com/en-US/windows-vista/Use-Snipping-Tool-to-capture-screen-shots (http://windows.microsoft.com/en-US/windows-vista/Use-Snipping-Tool-to-capture-screen-shots)
Title: Re: General question about VLIDE and Coding
Post by: alanjt on December 14, 2011, 10:59:55 AM
:angel: cough (http://www.gadwin.com/printscreen/)
BTW, if you have Vista/W7, the new Snipping tool also does a great job: http://windows.microsoft.com/en-US/windows-vista/Use-Snipping-Tool-to-capture-screen-shots (http://windows.microsoft.com/en-US/windows-vista/Use-Snipping-Tool-to-capture-screen-shots)
Well damn, that's pretty cool too! LoL
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 14, 2011, 11:04:34 AM
Enough about the screen grabbing  :pissed:

To get the best of both worlds you can do what I sometimes do: Have the LSP open in VLIDE as well as your favourite editor (mine's SciTE). That way you can have code completion, proper formatting, folding, regex S&R ect. As soon as you save from the external editor, you can return to VLIDE, it will tell you the file's changed and ask if you want it reloaded. Then you can go ahead and do your debugging there.
Title: Re: General question about VLIDE and Coding
Post by: nivuahc on December 14, 2011, 11:14:56 AM
:angel: cough (http://www.gadwin.com/printscreen/)
BTW, if you have Vista/W7, the new Snipping tool also does a great job: http://windows.microsoft.com/en-US/windows-vista/Use-Snipping-Tool-to-capture-screen-shots (http://windows.microsoft.com/en-US/windows-vista/Use-Snipping-Tool-to-capture-screen-shots)

tres cool  :kewl:
Title: Re: General question about VLIDE and Coding
Post by: JohnK on December 14, 2011, 11:27:45 AM
I'm with the others in this thread who use a text editor. I don't have worry much about formatting but I have adopted a sort of system in my editor which is actauly best described as "adaptive" (I got that word from the link below) based upon filetypes. Ive been thinking that I may want to expand on this this theory a bit and try to create a system which will allow for alternates for each filetype but that's later.

REF:
I answered a similar question about this on stackoverflow a while back.
http://stackoverflow.com/a/6950427/875064
Title: Re: General question about VLIDE and Coding
Post by: StykFacE on December 14, 2011, 10:05:29 PM
Awesome! Thanks for the replies everyone. I'll keep that in mind when I'm monkeying around with more code. I never thought about looking at the two icons with the triangles, I'll mess around with those tools as well.

I've seen that some people has extremely clean formatted code and it always seemed like it would be a pain to try and make it that way, but a well organized code says something about the coder in my opinion. Glad to finally hear it from you guys.

 :kewl:
Title: Re: General question about VLIDE and Coding
Post by: StykFacE on December 14, 2011, 10:08:37 PM
Yep, the "triangle" buttons like attached. Just remember to setup your Tools --> Environment Options --> Visual LISP Format Options to something you like. I prefer not having those default ;_ end of ... comments added all over the place.
Irneb, would you mind elaborating on your settings a bit from your screenshot? I see that they do not match the default settings. I understand some of the options but others I don't.
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 15, 2011, 01:39:02 AM
Some of these are a bit of personal preference. You can of course choose your "own look":
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 15, 2011, 01:55:18 AM
I've seen that some people has extremely clean formatted code and it always seemed like it would be a pain to try and make it that way, but a well organized code says something about the coder in my opinion. Glad to finally hear it from you guys.

 :kewl:
:lmao: I think it just says they use the formatting function. I don't think you get many who'd be so pedantic as to press 1000's of spaces in different lines just to get the formatting "just-right". The only guys who "have-to" do that is Python programmers, where the indentation actually has some meaning in the action of the source code. But then their editors would have an auto-indent feature anyway.

Edit: Actually, the manual "spacing" to indent always gives me an itchy feeling as I generally see typists hit the spacebar 10 times per line to go and indent a paragraph in Word. I've given up trying to explain to them the "oh-so-new" feature of Word where you can simply set a paragraph's intents to have it done automatically for you.
Title: Re: General question about VLIDE and Coding
Post by: Lee Mac on December 15, 2011, 07:00:46 AM
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :-)
Title: Re: General question about VLIDE and Coding
Post by: Krushert on December 15, 2011, 07:30:46 AM
Good thread.  Very good thread.  2 birds with one thread.  :wink:
Title: Re: General question about VLIDE and Coding
Post by: irneb on December 15, 2011, 08:10:59 AM
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :)
You mean you format it in NotePad?

If in any other decent code editor (even VLIDE) most of the formatting is done on the fly. VLIDE's format function just completes where its auto-indenting falls short.

So what you mean is you type the code into VLIDE and then fix the screwups with its auto-indent manually? ... Well ... I did say "most" wouldn't be as pedantic  ;)
Title: Re: General question about VLIDE and Coding
Post by: Lee Mac on December 15, 2011, 08:19:22 AM
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :)
You mean you format it in NotePad?

No, I write the code in VLIDE, but don't use the option to format it automatically.
Title: Re: General question about VLIDE and Coding
Post by: JohnK on December 15, 2011, 08:24:52 AM
lmao @ `pedantic'.
Title: Re: General question about VLIDE and Coding
Post by: alanjt on December 15, 2011, 09:30:25 AM
I never use the formatting utility in the VLIDE, I format the code manually as I write it  :)
You mean you format it in NotePad?

No, I write the code in VLIDE, but don't use the option to format it automatically.
That's a lot of work.
Title: Re: General question about VLIDE and Coding
Post by: MP on December 15, 2011, 09:52:06 AM
:lmao: I think it just says they use the formatting function.

And yet you'd be wrong. (http://www.theswamp.org/screens/mp/poke.gif)
Title: Re: General question about VLIDE and Coding
Post by: MP on December 15, 2011, 09:52:49 AM
That's a lot of work.

Not really.