Author Topic: Is there a batch lisp files format pretty rountine?  (Read 3385 times)

0 Members and 1 Guest are viewing this topic.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Is there a batch lisp files format pretty rountine?
« on: July 19, 2006, 05:55:34 AM »
Usually I use LispLink to pretty one lisp file when edit it. but now I have 80 lisp files with bad format, Is there a batch pretty lisp file format rountine to pretty them.The format of Emacs lisp is rather pretty, could I program one lisp to do this batch thing or someone else has wrote it?

Thank you very much.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Is there a batch lisp files format pretty rountine?
« Reply #1 on: July 19, 2006, 08:19:45 AM »
I was hoping to find a CLI answer to this question but so far nothing. I can do this in a pseudo batch mode using Vim but I would still have to open all the files first.

TheSwamp.org  (serving the CAD community since 2003)

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Is there a batch lisp files format pretty rountine?
« Reply #2 on: July 19, 2006, 09:39:21 AM »
Thomas, could you tell me how to use pseudo batch mode using gvim, thank you very much. :-)
I think the problem of pretty code will be the gramma of the language, Lisplink can do it, maybe lisp rountine could also do it, at the same time, the  format that lisplink pretty is not so good, it should have a more beautiful effect.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Is there a batch lisp files format pretty rountine?
« Reply #3 on: July 19, 2006, 10:44:49 AM »
First open all the files you want to edit with Gvim.

From shell. gvim list_of_files*.lsp that can be 2 or 42!

From the CLI in Gvim
:bufdo normal gg | VG | =

:     [ moves to the command line in Vim ]
bufdo [ for each of the buffers ( files ) loaded do the following command(s) ]
gg    [ go to the top of the file ]
   [ command separator ]
VG    [ start 'visual' mode selection, whole line, G [ to the end of the file ] ]
=     [ tells Vim to indent code according to file-type ]
« Last Edit: July 19, 2006, 11:04:21 AM by Mark Thomas »
TheSwamp.org  (serving the CAD community since 2003)

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Is there a batch lisp files format pretty rountine?
« Reply #4 on: July 19, 2006, 08:17:07 PM »
Thank you very much, I will try first.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Is there a batch lisp files format pretty rountine?
« Reply #5 on: July 19, 2006, 09:29:58 PM »
Shot in the dark, but maybe you could make the stuff work in this post.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

FengK

  • Guest
Re: Is there a batch lisp files format pretty rountine?
« Reply #6 on: July 20, 2006, 02:02:25 AM »
The visual lisp editor from AutoCAD doesn't do a good job for you?

Not sure if this will help you in any way, but I suggest you check out a language called AutoIt. It is probably the easiest language I've seen. Yet you can use it to automate many tasks in windows, simulating keystrokes, mouse movement any much more. The help file comes with tons of example and there is a rather active forum as well.  One of the nicest thing I like about it is you can right-click a source code file and compile it into an .exe file.  It can't get any easier. Anyway, I think it is something worth checking out. The website is at
http://www.autoitscript.com/


Usually I use LispLink to pretty one lisp file when edit it. but

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Is there a batch lisp files format pretty rountine?
« Reply #7 on: July 21, 2006, 08:36:53 PM »
Thank you all
Thomas
gvim is a great software, I am still learning on it, but I cant pretty code as your guide, I will try again.
BTW, is there an autolisp syntax? I try to add the function vl-*** to the lisp.vim, but the systax file seems complicate, I still dont know how to sort "OSMODE"  /  "LINE"   / "COMMAND"  to the KEYWORD or VARIABLE or else, if there is the autolisp syntax already, that is wonderful, or I have to add them myself.

Willey,
MP's code is rather good, I think it really a road to pretty the code, I need some time to read through the code.

kelie,
thank you, do you mean that use autoscript and let vlide to automatic pretty the code one by one?
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

FengK

  • Guest
Re: Is there a batch lisp files format pretty rountine?
« Reply #8 on: July 22, 2006, 02:42:25 AM »
yuanqiu,

That's was half what i was trying to getting at.  If you can manually open each file, and with a few mouse clicks, keystrokes to get your job done, you should be able to write it in AutoIt easily.  As I mentioned earlier, AutoIt can let u do a lot more.  If you've heard of an editor SciTE, there is a customized version called SciTE4AutoIt3, which makes editing and testing of AutoIt code much easier. There is a GUI builder for AutoIt too.  And the beta version of AutoIt supports COM, so it can be used to automate MS Office, AutoCAD, etc..

Anyway, if you have time, I say it's something worth taking a look.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Is there a batch lisp files format pretty rountine?
« Reply #9 on: July 22, 2006, 06:09:56 AM »
Thank you all
Thomas
gvim is a great software, I am still learning on it, but I cant pretty code as your guide, I will try again.
BTW, is there an autolisp syntax?

Replace the one you have with this one.
[ http://www.theswamp.org/~mark/lisp.vim ]
TheSwamp.org  (serving the CAD community since 2003)

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Is there a batch lisp files format pretty rountine?
« Reply #10 on: July 23, 2006, 01:00:40 AM »
kelie
thank you, I have downloaded SCITEAutoit3, and still learning, but English is still somewhat difficult for me, but I will still try to learn it, I think it is very useful to use autoit to do the batch work.

Thomas
Thank you, now it works, more beautiful when use the evening scheme.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)