[Top][All Lists]

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

Re: making software with Emacs and Elisp

From: Pascal J. Bourguignon
Subject: Re: making software with Emacs and Elisp
Date: Fri, 25 Oct 2013 00:00:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Emanuel Berg <address@hidden> writes:

> "Pascal J. Bourguignon" <address@hidden> writes:
>> emacs does manage memory, or schedule processor time
>> for the various functions running in emacs.
> So it does? Then it *is* an OS within the OS, at the
> very least, like a Chinese box or those Russian
> dolls. 


> But - when does this happen? 
> And how is it done?

> For example, if I write an interactive defun, I always
> thought that was executed sequentially upon
> invocation. Is that so?  And, how do I code a defun that
> is interactive in the sense it can be invoked by the
> user, but "batch" in the sense that it is run in the
> background, perhaps as an infinite loop? And if I make
> two such defuns, can I give them different priorities,
> and otherwise like the PCBs of a "real" OS, to setup how
> they should relate to everything else?

If you want to run processes in the outer system you can call
start-process amongst a few other functions.

But you can have code scheduled to run in emacs.  It is not a preemptive
system, but a collaborative one, where each task must release the CPU
quickly enough for the rest of the system to stay responsive.  But a lot
of tasks are scheduled this way in emacs (eg. background font-locking,
semantic incremental parses, etc). See: run-with-idle-timer

Things like priorities or "how things relate to everything else" are
notions specific to a given system.  Eg. emacs run-with-idle-timer
doesn't deal with priorities, only with timing. 

>> Also, "Operating System" doesn't mean unix-like
>> architecture.  You can have very different
>> architectures.
> Yeah, I guess that's just a schoolbook issue anyway.
>> $ emacs -Q --batch -l myprogram.el
>> ...
>>     $ cat myprogram
>>     #!/bin/sh
>>     exec emacs -Q --batch -l myprogram.el
> Great!

__Pascal Bourguignon__

reply via email to

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