From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Fren Zeee Newsgroups: gmane.emacs.devel Subject: Re: What is emacs architecture ? Date: Sun, 18 Jul 2010 21:49:50 -0700 Message-ID: References: <20100707.150746.549331509773933118.yamato@redhat.com> <87aaq3qpo7.fsf@kslab.red-bean.com> <8739vvxkqr.fsf@escher.home> <8739vvoyak.fsf@kslab.red-bean.com> <87eifek5zm.fsf@uwakimon.sk.tsukuba.ac.jp> <1278562570.16810.20.camel@logrus.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1279515183 12779 80.91.229.12 (19 Jul 2010 04:53:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 19 Jul 2010 04:53:03 +0000 (UTC) Cc: emacs-devel@gnu.org To: Jeff Clough Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 19 06:53:00 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OaiJU-0005ST-9k for ged-emacs-devel@m.gmane.org; Mon, 19 Jul 2010 06:52:59 +0200 Original-Received: from localhost ([127.0.0.1]:49734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OaiJL-0005hK-0r for ged-emacs-devel@m.gmane.org; Mon, 19 Jul 2010 00:50:39 -0400 Original-Received: from [140.186.70.92] (port=38604 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OaiJ4-0005cL-AW for emacs-devel@gnu.org; Mon, 19 Jul 2010 00:50:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OaiIa-0007iC-Gb for emacs-devel@gnu.org; Mon, 19 Jul 2010 00:49:53 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:64674) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaiIa-0007i4-AB for emacs-devel@gnu.org; Mon, 19 Jul 2010 00:49:52 -0400 Original-Received: by wyj26 with SMTP id 26so4699984wyj.0 for ; Sun, 18 Jul 2010 21:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=R9zUAutcFSFvdP5GDJDPIF0lwEr5p7p17e0XWZ4qmLo=; b=stSGUVm7oD7nULNGsUP19vR5oo7lOPuP0xAa/7RfRQ5u/8w/skghsOzAvchxHlr4cG wTWSCqYLXSbGsF2th9e1YjK4RrYPqp55Qz7DTlAkru+xliAldJaa8kaSPtaC8vNSoiSL 8QqXOQn82QhYC66zllCz+rOv/Xb6P4utTWkQo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=RkQnwlXO6nwpthBp3aBZLtBP/qi4Z681nbyjfRWMieHDe+TNDjoATJb/WkWUGJqFrz pkf5SJ5W1y1SmWvrBwummQQA7Raqh5rgmxae8T3KUh9zgcplL6CsP0zU4ZU+IlXcDz7d 1gdbXkZLCc0a28YNyjzDBP1nSkkTnnBTZpKgA= Original-Received: by 10.227.28.155 with SMTP id m27mr3544387wbc.66.1279514990982; Sun, 18 Jul 2010 21:49:50 -0700 (PDT) Original-Received: by 10.227.133.81 with HTTP; Sun, 18 Jul 2010 21:49:50 -0700 (PDT) In-Reply-To: <1278562570.16810.20.camel@logrus.localdomain> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127568 Archived-At: On Wed, Jul 7, 2010 at 9:16 PM, Jeff Clough 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. =A0Here's > what I suggest as to learning how Emacs is built at the C level. > > 1. =A0Most of Emacs isn't even *at* the C level. =A0It's in the Lisp > sources. =A0Make 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. =A0Here, the Emacs Lisp debugger is your friend. =A0Learn > how to unconditionally invoke it. =A0Create a function in Lisp which does > this, then runs some interesting functions. =A0Step through and watch wha= t > happens. > > 2. =A0Once 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. =A0Emac= s > 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. =A0Find > the definitions for those macros and "hand expand" them to find out what > is truly happening behind the scenes. > > 3. =A0Even seemingly trivial functions defined in the C sub-strata have a > lot of cool stuff. =A0Look at "(point)" as an example. > > 4. =A0Stay away from running gdb. =A0You don't need to be stepping throug= h > code at that level. =A0You need to be understanding things like what cons > cells are made of, what a buffer is, how buffer local variables work, > etc. =A0That means reading their code, not threading your way through the > execution stack to learning how one specific use of these things is > handled. > > 5. =A0Question everything. =A0If you look at the math functions, for > instance, you might see that *two* checks are done to find floating > point numbers when division occurs. =A0Try to figure out why this happens= . > > 6. =A0Create your own "toy" functions at the C level and expose them to > Lisp. =A0These might even be non-toy functions. =A0If you run even the mo= st > "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. =A0Find a > way to not do that and implement it. > > 7. =A0Ultimately, the best way to learn how something like Emacs works is > to hack at it. =A0Make it do something else. =A0Break it. =A0Explore. =A0= 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 sessi= on as proof of an assignment, as the typescript file can be printed out later with lpr(1).