help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Too fine design granularity leads to numerous macro/function/command


From: Eli Zaretskii
Subject: Re: Too fine design granularity leads to numerous macro/function/command existed in Emacs.
Date: Sat, 14 Aug 2021 09:18:41 +0300

> From: Hongyi Zhao <hongyi.zhao@gmail.com>
> Date: Sat, 14 Aug 2021 08:46:27 +0800
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> > Specifically about the one example you provided: directory-files is a
> > primitive, written in C, so it provides the basic functionality of
> > fetching file names from a single directory. The
> > directory-files-recursively function is written in Lisp, it builds on
> > that primitive and provides extended functionality.
> 
> Thank you for letting me know this difference, which I really didn't
> notice before. But there's still one question I don't understand:
> C is a compiled language, so how does the compilation and invocation
> of such C primitives work in Emacs? Are they compiled into libraries
> and called in real time?

The low-level infrastructure of the Lisp machine in Emacs is also
written in C, and that includes the primitives used to call Lisp
functions.  Those primitives have a special way of calling other
primitives written in C.  Basically, a primitive written in C is
wrapped in a special 'subr' object that tells Emacs about this, and
then such primitives are called via the normal C mechanisms of calling
functions.

For more details, I suggest to study the node "Writing Emacs
Primitives" in the ELisp manual.



reply via email to

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