From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.devel Subject: Re: How can I put together a small bare bones "Emacs for scripting" package? Date: Fri, 24 Jan 2020 22:37:14 +0100 Message-ID: References: <83o8usrh1k.fsf@gnu.org> <83lfpwrfol.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000540d7c059ce99061" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="63149"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jan 24 22:38:23 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iv6ek-000GNQ-R2 for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Jan 2020 22:38:22 +0100 Original-Received: from localhost ([::1]:48324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv6ej-0003J4-UE for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Jan 2020 16:38:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45936) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv6e7-0002di-P3 for emacs-devel@gnu.org; Fri, 24 Jan 2020 16:37:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iv6e5-00054r-Bx for emacs-devel@gnu.org; Fri, 24 Jan 2020 16:37:42 -0500 Original-Received: from mail-vk1-xa29.google.com ([2607:f8b0:4864:20::a29]:40344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iv6dx-0004xf-O0; Fri, 24 Jan 2020 16:37:34 -0500 Original-Received: by mail-vk1-xa29.google.com with SMTP id c129so978048vkh.7; Fri, 24 Jan 2020 13:37:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tqFVmnG/wYHS3v80ZhFXGQid+Ii419kRXWI7cTx9yNo=; b=rEsv3RHszH1ugXabvPDqdYFQ7Pl26AzBhNbSP91+dX4wQ98OTaJueN4BinhM/6s0C5 BQT2EloWADNKet146BZWYOlMD+FZDleooLpmhQ8h9Tg5q0UJ8Vr+LfuqfDDWZ+0pPFPh gHqxKE3Yy0afEc8d3cBpsjrqI4yGi07KiH5QkTSGTm9uLiL5LHMHDW1awlgOD/mDK93S eo24lrHlVFngU6ZVzo3iLSqqzIxy9ZzUo8bWlbz4SstBzX7XSS6jI8kWD/QsEvT3VnJj ebbEPcQe51O07TPTmytSAWMJJampvmSzX45Wm0F7+sS3YXo0N68wyJfez4e49jKEFA+u eMGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tqFVmnG/wYHS3v80ZhFXGQid+Ii419kRXWI7cTx9yNo=; b=IYzvDnuKa5FPNy7N1SyXyy7dmTp7GxZ9v1t4bgufi9VKsCbsKuJdgY+u9rQEgtfowr yysCE+jTadG8F8RXWZ8qIvEiKkw5Ivbtll//kyDqFk8oSu2TuLwWOduGVlpC57QgG3TV 9BK5WsBynGBbg6N8v7sklk4Xh9jtFx9ZNJrEjRdGC8Zpgd+3OwwjINQWnEnoNk+mueiD jh3uIGjirJ3P9DIvBKRvPeUa44hyU7cGkSV+gTj6pdHeBHTCaDBLBehUb3nkSLPX9Z1V od/9UoMxCLLLrvYcjsPvl/9xeuiYdZxYteCvrcmI0S07mfzeEENtuKhOGBWnSaJS2K42 M6pg== X-Gm-Message-State: APjAAAUUhHCrCVYzNL18iLcd+EkSkAmJKvD8QL7Pr6YsJ0+v/p0ugcKr WLgtv0UTCeco2cehVcHO2hFGb5UMJ0DnURRKO+LlpzHu1rKx1g== X-Google-Smtp-Source: APXvYqxtn+mqk0/FeEqE1DEdOvVR3mSNSTB+OZk8MwOVqinQPdzwr7wSy7fOHVuunAZNSei8oIOkSj3nCfm40Zw0e2Y= X-Received: by 2002:a1f:434b:: with SMTP id q72mr3189886vka.53.1579901846292; Fri, 24 Jan 2020 13:37:26 -0800 (PST) In-Reply-To: <83lfpwrfol.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::a29 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244587 Archived-At: --000000000000540d7c059ce99061 Content-Type: text/plain; charset="UTF-8" > > > Start with emacs.exe alone, and then add *.elc files according to > > error messages you get. You will need lisp/term/w32-win.el at least, > > but other than that, I don't know. > > I see you'd also need simple.elc (because we look for it at startup), > and with Emacs before 27 also mule-util.elc. Emacs will probably > complain about a missing libexec directory, so create it. > Thanks! Got it to work. Here seems to be the bare minimum structure needed for Emacs 26.3 on Windows 10: ./bin ./bin/emacs.exe ./libexec ./libexec/emacs ./libexec/emacs/26.3 ./libexec/emacs/26.3/x86_64-w64-mingw32 ./share ./share/emacs ./share/emacs/26.3 ./share/emacs/26.3/etc ./share/emacs/26.3/etc/charsets ./share/emacs/26.3/etc/charsets/8859-10.map ... a lot of map files goes here .. ./share/emacs/26.3/lisp ./share/emacs/26.3/lisp/simple.el ./share/emacs/26.3/lisp/term ./share/emacs/26.3/lisp/term/w32-win.el I could then successfully do this (from cmd.exe, a similar command also worked from Git Bash) C:\...> bin\emacs.exe --batch -Q --eval "(princ """This is cool!""")" This is cool! C:\...> I might write up something more detailed on EmacsWiki later. It took a bit of trial and error to get it to work and the error messages are only partly helpful (they mention looking in c:\emacs, a folder that does not exist, and which is not needed). One thing that I noticed is the HUGE difference in size of the exe file between Emacs 24 and later versions. I listed the sizes of the folder when I keep my different Emacs versions: 8.8M ./emacs-24.5-official/bin/emacs.exe 91M ./emacs-25.1-2-x86_64-w64-mingw32_2016_11_16/bin/emacs.exe 119M ./emacs-26.1-x86_64/bin/emacs.exe 120M ./emacs-26.2-x86_64/bin/emacs.exe 130M ./emacs-26.3-x86_64/bin/emacs.exe 16M ./emacs-bin-w64-24.4/emacs/bin/emacs.exe 121M ./emax64-bin-20180529/emax64/bin/emacs.exe 119M ./old/emacs-26.1/bin/emacs.exe Now, I can probably use an old version for the mentioned scenarios (using Emacs as a kind of scripting engine), but I am curious about the jump in sizes. I assume that later versions include something that was earlier "outside", in separate files, is that right? If I wanted to, could I reduce the size by building Emacs myself? Is this in some way related to "dumping Emacs"? /Mathias --000000000000540d7c059ce99061 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> Start with emacs.exe alone, and then add *.elc file= s according to
> error messages you get.=C2=A0 You will need lisp/term/w32-win.el at le= ast,
> but other than that, I don't know.

I see you'd also need simple.elc (because we look for it at startup), and with Emacs before 27 also mule-util.elc.=C2=A0 Emacs will probably
complain about a missing libexec directory, so create it.
<= div>
Thanks!

Got it to work.=C2=A0

Here seems to be the bare minimum structure needed = for Emacs 26.3 on Windows 10:

./bin<= br>./bin/emacs.exe
./libexec
./libexec/emacs
./libexec/emacs/26.3<= br>./libexec/emacs/26.3/x86_64-w64-mingw32
./share
./share/emacs
.= /share/emacs/26.3
./share/emacs/26.3/etc
./share/emacs/26.3/etc/chars= ets
./share/emacs/26.3/etc/charsets/8859-10.map
... a lot of map file= s goes here ..
./share/emacs/26.3/lisp
./share/emacs/26.3/lisp/simple= .el
./share/emacs/26.3/lisp/term
./share/emacs/26.3/lisp/term/w32-win= .el

I could then successfully do this (from cmd.exe, a simila= r command also worked from Git Bash)

=C2=A0= C:\...> bin\emacs.exe --batch -Q --eval "(princ """= This is cool!""")"
=C2=A0 This is cool!
=C2=A0 C:= \...>

I might write up something mor= e detailed on EmacsWiki later. It took a bit of trial and error to get it t= o work and the error messages are only partly helpful (they mention looking= in c:\emacs, a folder that does not exist, and which is not needed).
=

One thing that I noticed is the HUGE difference in size= of the exe file between Emacs 24 and later versions. I listed the sizes of= the folder when I keep my different Emacs versions:

8.8M =C2=A0 =C2=A0./emacs-24.5-official/bin/ema= cs.exe
91M =C2=A0 =C2=A0 ./emacs-25.1-2-x86_64-w64-mingw32_2016_11_16/bi= n/emacs.exe
119M =C2=A0 =C2=A0./emacs-26.1-x86_64/bin/emacs.exe
120M = =C2=A0 =C2=A0./emacs-26.2-x86_64/bin/emacs.exe
130M =C2=A0 =C2=A0./emacs= -26.3-x86_64/bin/emacs.exe
16M =C2=A0 =C2=A0 ./emacs-bin-w64-24.4/emacs/= bin/emacs.exe
121M =C2=A0 =C2=A0./emax64-bin-20180529/emax64/bin/emacs.e= xe
119M =C2=A0 =C2=A0./old/emacs-26.1/bin/emacs.exe

Now, I can probably use an old version for the mentioned sc= enarios (using Emacs as a kind of scripting engine), but I am curious about= the jump in sizes. I assume that later versions include something that was= earlier "outside", in separate files, is that right? If I wanted= to, could I reduce the size by building Emacs myself? Is this in some way = related to "dumping Emacs"?

/Mathias


--000000000000540d7c059ce99061--