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

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

Re: Learning LISP; Scheme vs elisp.


From: Xah
Subject: Re: Learning LISP; Scheme vs elisp.
Date: Sat, 2 Aug 2008 06:51:26 -0700 (PDT)
User-agent: G2/1.0

On Aug 1, 5:45 am, Adam Funk <a24...@ducksburg.com> wrote:

> In the long term I hope I'll be able to customize Emacs more in its
> native way instead of wrapping external Perl programs in
> shell-command-on-region (as I often do now).

if all you need to do is text processing and perl currently satisfies
your needs, then what you are doing now is good enough. Trust me.
Learning elisp would be like waste of time.

however, elisp for text processing is actually more powerful, because
of the buffer datatype, where you can move cursor to and pro. (i.e. in
perl, you just slurp the text file so that you have a array of lines
or the whole file as a single string. In emacs, the whole file text is
a buffer, where you can move the index to arbirary points using
various highlevel functions such as regex. In perl, you can also move
the index in a file, but then you deal with the file as a stream and
bytes)

 As a concret example, suppose you need to do some simple manipulation
of nested text such as XML. In perl with regex, you quickly fail
because regex is unable to match nested syntax. You end up either with
covoluted solution or go full using a XML parser (at which point it
becomes rather complex and no longer text processing and you lose your
xml formatting)

But in elisp, because you deal with buffers, you can move cursor into
or out of nested text. So, you can still use text processing method to
do simple xml manipulation.

For concrete examples, see:

elisp lessens on text processing:
http://xahlee.org/emacs/elisp_text_processing.html
http://xahlee.org/emacs/elisp_process_html.html

text processing in elisp vs perl (essay)
http://xahlee.org/emacs/elisp_text_processing_lang.html

  Xah
∑ http://xahlee.org/

reply via email to

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