From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jadamson@partners.org (Joel J. Adamson) Newsgroups: gmane.emacs.help Subject: Re: is Emacs completely written in lisp Date: Tue, 20 Nov 2007 13:42:01 -0500 Organization: I need to put my ORGANIZATION here. Message-ID: <87wsscbvye.fsf@W0053328.mgh.harvard.edu> References: <0b863c61-a1fd-43fe-b160-f257f660d416@c29g2000hsa.googlegroups.com> <5qg0qsFvs4boU1@mid.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1195587644 19922 80.91.229.12 (20 Nov 2007 19:40:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Nov 2007 19:40:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 20 20:40:50 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IuYxl-0007oN-L6 for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Nov 2007 20:40:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IuYxX-0007sF-Lj for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Nov 2007 14:40:35 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!news.glorb.com!newspeer1.asbnva01.us.to.verio.net!news.harvard.edu!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 85 Original-NNTP-Posting-Host: w0053328.mgh.harvard.edu Original-X-Trace: plato.harvard.edu 1195584121 9695 132.183.29.121 (20 Nov 2007 18:42:01 GMT) Original-X-Complaints-To: news@plato.harvard.edu Original-NNTP-Posting-Date: Tue, 20 Nov 2007 18:42:01 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:+jqeL0i5j6YiZ045xPvs1Y4T9eU= Original-Xref: shelby.stanford.edu gnu.emacs.help:153937 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49369 Archived-At: arunmib writes: > On Nov 20, 5:04 pm, Marc Tfardy wrote: >> arunmib schrieb: >> >> > Hi all, >> > Is Emacs completely written in Lisp or is written in combination >> > with some other language. What I am trying to ask is the UI and other >> > OS dependent stuff (if any, I don't know this thing) is also written >> > in Lisp or some other language, like C is also used.... >> >> C + ELisp >> >> Marc > > Out of curiosity, can you tell me how? just a general overview or some > place where I can read, how this is done? Stallman's article is a good place to hear about the why and how: http://www.gnu.org/gnu/rms-lisp.html. My understanding is that the functions that really need to work fast and often, as well as the Emacs Lisp interpreter are in C. Basically the backbone is C and the Lisp interpreter (a full-on REPL) takes care of the rest. If you `M-x apropos' and look up a function name, it will tell you if it's in C or Lisp, along with a link to the file where you can find the function. For example `self-insert-command', which is invoked every time I press a key is in C: **************************************** DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p", doc: /* Insert the character you type. Whichever character you type to run this command is inserted. */) (n) Lisp_Object n; { CHECK_NUMBER (n); /* Barf if the key that invoked this was not a character. */ if (!CHARACTERP (last_command_char)) bitch_at_user (); { int character = translate_char (Vtranslation_table_for_input, XINT (last_command_char)); if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) { int modified_char = character; /* Add the offset to the character, for Finsert_char. We pass internal_self_insert the unmodified character because it itself does this offsetting. */ if (! NILP (current_buffer->enable_multibyte_characters)) modified_char = unibyte_char_to_multibyte (modified_char); XSETFASTINT (n, XFASTINT (n) - 2); /* The first one might want to expand an abbrev. */ internal_self_insert (character, 1); /* The bulk of the copies of this char can be inserted simply. We don't have to handle a user-specified face specially because it will get inherited from the first char inserted. */ Finsert_char (make_number (modified_char), n, Qt); /* The last one might want to auto-fill. */ internal_self_insert (character, 0); } else while (XINT (n) > 0) { /* Ok since old and new vals both nonneg */ XSETFASTINT (n, XFASTINT (n) - 1); internal_self_insert (character, XFASTINT (n) != 0); } } return Qnil; } **************************************** (a function called bitch_at_user() --- that's a good one) I learn a lot by using apropos. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109