From: jadamson@partners.org (Joel J. Adamson)
To: help-gnu-emacs@gnu.org
Subject: Re: is Emacs completely written in lisp
Date: Tue, 20 Nov 2007 13:42:01 -0500 [thread overview]
Message-ID: <87wsscbvye.fsf@W0053328.mgh.harvard.edu> (raw)
In-Reply-To: bcfbf8a1-dd60-45c8-8646-3ee81c62021a@s19g2000prg.googlegroups.com
arunmib <arunmib@gmail.com> writes:
> On Nov 20, 5:04 pm, Marc Tfardy <m-t-o___CUT__IT...@web.de> 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
next prev parent reply other threads:[~2007-11-20 18:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 11:30 is Emacs completely written in lisp arunmib
2007-11-20 12:04 ` Marc Tfardy
2007-11-20 16:58 ` arunmib
2007-11-20 17:14 ` B. T. Raven
2007-11-20 18:01 ` rustom
2007-11-20 18:47 ` The Lisp High (was: is Emacs completely written in lisp) Joel J. Adamson
2007-12-16 17:52 ` David Combs
2007-11-20 18:42 ` Joel J. Adamson [this message]
2007-11-21 4:00 ` is Emacs completely written in lisp arunmib
2007-11-21 14:58 ` Joel J. Adamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wsscbvye.fsf@W0053328.mgh.harvard.edu \
--to=jadamson@partners.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.