help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strangle problem with batch mode.


From: Andy Stewart
Subject: Re: Strangle problem with batch mode.
Date: Fri, 13 Feb 2009 14:53:59 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi Xah,

Now elisp-format.el can work with 98% code.
I have test 1014 elisp files that build-in GNU Emacs 23.
Have some speical case i haven't consider.
I will fix it.

Now the update process is *slow*, because i'm really too busy.

I won't spend many time to test and fix it, because elisp-format.el is
not necessary to me.

I will fix it more faster if someone can pay for my time.

And the code is under GPL 3, so anyone can modified it and release new
version.

And elisp-format.el need test widely before it perfect.
Any patch are welcome!

Enjoy!

  -- Andy


Xah Lee <address@hidden> writes:

> On Feb 11, 1:11 am, Andy Stewart <address@hidden> wrote:
>> Hi all,
>>
>> I write elisp-format.el for format elisp file.
>> File athttp://www.emacswiki.org/cgi-bin/emacs/elisp-format.el
>> Detail describe athttp://www.emacswiki.org/cgi-bin/emacs/ElispFormat
>>
>> In elisp-format.el, have a command "elisp-format-directory" can format
>> elisp files under specify directory.
>>
>> Example, eval (elisp-format-directory "~/elisp/") can format all elisp
>> files under "~/elisp/".
>>
>> But when i use command
>>
>> emacs -batch -l ~/MyEmacs/Site-Lisp/Packages/LazyCatSelf/elisp-format.el 
>> --eval="(progn (require
> elisp-format) (elisp-format-directory \"~/elisp/\"))"
>>
>> it can't work.
>>
>> I don't know why `batch' mode can't work.
>>
>> Any idea?
>>
>> Thanks!
>>
>>   -- Andy
>
> Btw, i promised Andy a thank you money of $15, and promised to pay him
> $50 if this code is practically usable. If anyone could pitch in some
> ammount, even $5, will be great!
>
> Let me explain why i think this is very important.
>
> Today, coders, in about any language, format his code manually, on a
> line-by-line basis. Although how many indentation is taken care of in
> most editors, however, it is still manual process on every line.
>
> For example, in perl, when i type
>
> for (my $var = 0; $var < 5; $var++) {
>
> then i have to press return, at that point.  Then, depending on the
> editor, i might have to press Tab.  Sure, there are template systems
> that takes care of the whole β€œfor” loop, but on the whole, programers
> are essentially manually formatting each and every line of code.
>
> With today's hardware speed and much software advancement, much of
> these labor can be done by machine. A coder, should be able to press a
> button, then the current semantic unit of the lang will be
> automatically formatted to his preference settings. Press another
> button, the whole file is auto formatted to his liking. Similarly,
> calling a function can auto-format entire dir of source code. This
> feature can be builtin in the editor.
>
> occasionally you'll see such a tool available in one lang or another,
> but in general, programers are still manually doing formatting line by
> line, in just about all editors.
>
> The above depicts the vision. (^_^)
>
> for now, we can start with lisp source code, with emacs. Lisp source
> code has a very simple lexical grammar, and emacs is quite powerful in
> text processing. So, i imagined, it is not too difficult to have a
> auto-formatter in emacs for elisp code. For example, suppose i am
> going to write a function
>
> (defun previous-user-buffer ()
>   "Switch to the next user buffer in cyclic order."
>   (interactive)
>   (previous-buffer)
>   (let ((i 0))
>     (while (and (string-match "^*" (buffer-name))
>                 (< i 10))
>       (setq i (1+ i))
>       (previous-buffer))))
>
> I don't have to press return, tab, in every step. I can simply type
> them straight, and when the line gets too long or when i want to, i
> press a button, it gets broken into multiple lines at proper places
> with proper number of tabs. This is similar to how editing in word
> processor progressed. (in the 1980s, writer has to press return when
> cursor reaches the right margin. But since 1990s, auto-wrap is there.)
> If programer wants, he can set the auto wrap to be automatic, much
> like emacs automatic option for fill-region.
>
> Note that this feature, in whole perfection, is buildin in the
> Mathematica language's editor (aka Frontend) since 1997. It not only
> does one-dimentional pure text source code formatting, but deals with
> source code that renders into 2D typeset mathematics in real time, all
> on the fly, as you edit.
>
> back to elisp with emacs... as a first step, we are aiming for these
> goals:
>
> A: provide a format-buffer functions, so that it will reformat all the
> code in the current buffer. (Andy alread did this superbly, with
> version that format current block, region, buffer, file, dir.)
>
> B: the result of reformat-buffer must remain 100% valid of the same
> behavior. For example, i can run reformat-buffer on all existing elisp
> files bundled with emacs, save them, compile them, and expect emacs to
> restart fine. Note: This must be achived 100%.
>
> C: About how exactly it formats, see a sample here:
>   http://xahlee.org/emacs/lisp_formatter.html
> The exact detail of formatting is not very important. The important
> thing is that the code will be able to correctly scan the lexical
> grammar of the code (as in B above). The exact formatting can be later
> tweaked to perfection, with customizable variables. It is ok if the
> code will format badly for say 5% of source code input. This still
> beats programer manually format every singe line.
>
> D: the speed should be practically usable. Say, 1000 lines of code for
> under no more that 5 sec on a mid range PC today.
>
> Once this works, i think it shouldn't be hard to make it work in
> common lisp, scheme lisp, clojure, newlisp.
>
> With today's tech, i think this is very doable with emacs. Andy
> already did a superb job, but there are still small problems to be
> fixed. Please try the code.
>
> If you can pitch in $5, please email me and Andy. That's be super!
>
> Thank you very much,
>
>   Xah
> βˆ‘ http://xahlee.org/
>
> β˜„





reply via email to

[Prev in Thread] Current Thread [Next in Thread]