emacs-devel
[Top][All Lists]
Advanced

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

Re: What is emacs architecture ?


From: Fren Zeee
Subject: Re: What is emacs architecture ?
Date: Sun, 18 Jul 2010 21:49:50 -0700

On Wed, Jul 7, 2010 at 9:16 PM, Jeff Clough <address@hidden> wrote:
> I mostly just lurk on the list and putter around in Emacs as a sort of
> hobby project at this point, but I've made a number of personal
> modifications to the code and have figured out a thing or two.  Here's
> what I suggest as to learning how Emacs is built at the C level.
>
> 1.  Most of Emacs isn't even *at* the C level.  It's in the Lisp
> sources.  Make darn sure you know Emacs Lisp and have followed a bunch
> of calls and threaded your way through the Emacs sources to know how
> that all works.  Here, the Emacs Lisp debugger is your friend.  Learn
> how to unconditionally invoke it.  Create a function in Lisp which does
> this, then runs some interesting functions.  Step through and watch what
> happens.
>
> 2.  Once you get to a function called by Emacs Lisp that is implemented
> in C, dive into the source for that function and work through it.  Emacs
> is a large, complex project and you will find a lot of pre-processor
> macros have been defined to make C suitable for it's development.  Find
> the definitions for those macros and "hand expand" them to find out what
> is truly happening behind the scenes.
>
> 3.  Even seemingly trivial functions defined in the C sub-strata have a
> lot of cool stuff.  Look at "(point)" as an example.
>
> 4.  Stay away from running gdb.  You don't need to be stepping through
> code at that level.  You need to be understanding things like what cons
> cells are made of, what a buffer is, how buffer local variables work,
> etc.  That means reading their code, not threading your way through the
> execution stack to learning how one specific use of these things is
> handled.
>
> 5.  Question everything.  If you look at the math functions, for
> instance, you might see that *two* checks are done to find floating
> point numbers when division occurs.  Try to figure out why this happens.
>
> 6.  Create your own "toy" functions at the C level and expose them to
> Lisp.  These might even be non-toy functions.  If you run even the most
> "minimal" of functions to read a file into a buffer in Emacs, you'll be
> implicitly invoking more than a dozen calls to other functions.  Find a
> way to not do that and implement it.
>
> 7.  Ultimately, the best way to learn how something like Emacs works is
> to hack at it.  Make it do something else.  Break it.  Explore.  Find a
> function like forward-char and go through it and all of the functions it
> calls until you know what every line of C does to make that command
> work.
>
> That's what I did, anyway, and it seems to work for me.
>
> Jeff
>

This newbie really liked the suggestions by Jeff , Stephen and many of
you. However, it would help me most by imitating at this stage and
requesting a typescript of a session, and some comments. Since this is
Jeff's reply, here it would be best to concentrate on the plan by
Jeff. I communicated with him and he has some time and health issues
so anyone of this group, all of you experienced gurus, can anyone run
a typescript of commands and send me the output. I can then convert to
pdf and put comment boxes if I have questions.

Thanks
Franz

The typescript would show the exact steps and our experience would be
exactly the same. script is a unix command.

DESCRIPTION
     Script makes a typescript of everything printed on your terminal.  It is
     useful for students who need a hardcopy record of an interactive session
     as proof of an assignment, as the typescript file can be printed out
     later with lpr(1).



reply via email to

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