automake-patches
[Top][All Lists]
Advanced

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

Re: Refactoring elisp compilation


From: Jack Kelly
Subject: Re: Refactoring elisp compilation
Date: Mon, 23 Jul 2012 18:29:33 +1000

On Tue, Jul 17, 2012 at 7:04 PM, Stefano Lattarini
<address@hidden> wrote:
> Maybe we could try to write to the Emacs list for help at this point...

I wrote the emacs list, and they pointed me to the NOMESSAGE argument
for (load). Unfortunately the rabbit hole goes deeper...

Emacs defines a variable, site-run-file, that is meant to be the
"first" thing loaded, before .emacs and before default.el. We can get
at that, but not with -Q. An autoconf check seems the correct approach
here (as part of AM_PATH_LISPDIR), running something like:

$(EMACS) -batch --eval "(princ site-run-file)" 2>/dev/null

(Is the redirect to /dev/null safe for DJGPP and/or MSYS?)

Because debian has to do things their own way, (I'm sure they have
their reasons), the initialisation process on debian systems is a
little more complicated than just running the site-run-file:
http://stackoverflow.com/q/189291/429232

Therefore, we can check if it's a debianised emacs with something like:

$(EMACS) -batch --eval "(unless (boundp 'debian-emacs-flavor) (kill-emacs 1))"

And we can get the actual flavour with this:

$(EMACS) -batch -eval "(princ debian-emacs-flavor)" 2>/dev/null

It is fairly easy to advise (load) so that it's always loading silently:

(defadvice 'load ('before 'silently) (ad-set-arg 2 t))
(ad-activate 'load)

Then the next step is to emulate the normal startup, which would be
something like:

(let ((debian-emacs-flavor (quote $flavor)) (site-run-file \"$sitefile\"))
  (when (debian-emacs-flavor)
    (load \"debian-startup\")
    (debian-startup debian-emacs-flavor))
  (load site-run-file))

At this point, we're well beyond what's sensible for a makefile
snippet, so we should really move it all into a .el file that lives in
$auxdir or a shell script with the elisp embedded. Do you have a
preference? I suppose a .el file saves an extra fork per .el file, and
I think there's sufficient command-line handling built into emacs that
it shouldn't be too hard to write a compile.el or el-compile.el (do
you have a name to suggest?).

-- Jack



reply via email to

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