[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is emacs architecture ?
From: |
Jeff Clough |
Subject: |
Re: What is emacs architecture ? |
Date: |
Thu, 08 Jul 2010 00:16:10 -0400 |
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
- What is emacs architecture ?, Fren Zeee, 2010/07/07
- Re: What is emacs architecture ?, Masatake YAMATO, 2010/07/07
- Re: What is emacs architecture ?, Karl Fogel, 2010/07/07
- RE: What is emacs architecture ?, Drew Adams, 2010/07/07
- Re: What is emacs architecture ?, Stephen Berman, 2010/07/07
- Re: What is emacs architecture ?, Karl Fogel, 2010/07/07
- Re: What is emacs architecture ?, Fren Zeee, 2010/07/07
- Re: What is emacs architecture ?, Karl Fogel, 2010/07/07
- Re: What is emacs architecture ?, Stephen J. Turnbull, 2010/07/07
- Re: What is emacs architecture ?,
Jeff Clough <=
- Re: What is emacs architecture ?, Fren Zeee, 2010/07/19
- Re: What is emacs architecture ?, Eli Zaretskii, 2010/07/08
- Re: What is emacs architecture ?, Thien-Thi Nguyen, 2010/07/08
- Re: What is emacs architecture ?, Karl Fogel, 2010/07/08
- Re: What is emacs architecture ?, Fren Zeee, 2010/07/19
- Re: What is emacs architecture ?, Óscar Fuentes, 2010/07/19
- Re: What is emacs architecture ?, Chad Brown, 2010/07/19
- Re: What is emacs architecture ?, Fren Zeee, 2010/07/19
- Re: What is emacs architecture ?, Chad Brown, 2010/07/19
- Re: What is emacs architecture ?, Stephen J. Turnbull, 2010/07/19