[Top][All Lists]

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

[emms-help] Re: [Emms-patches] darcs patch: use-existing-functionality-f

From: Nix
Subject: [emms-help] Re: [Emms-patches] darcs patch: use-existing-functionality-for-renaming-... (and 4 more)
Date: Sun, 19 Aug 2007 14:01:23 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.5-b28 (linux)

On 19 Aug 2007, Michael Olson outgrape:
> Nix <address@hidden> writes:
>> On 18 Aug 2007, Michael Olson outgrape:
>>> +(eval-when-compile
>>> +  (condition-case nil
>>> +      (require 'overlay)
>>> +    (error nil)))
>>> }
>> IIRC, this will lead to overlay not being required at runtime, which
>> means we'll still see the same failures. overlay.el isn't dumped into
>> XEmacs (it's part of the optional `fsf-compat' package and thus can't
>> be dumped).
>> If `overlay' isn't present on XEmacs we're going to die sooner or
>> later anyway so we might as well fail sooner.
> I'm uncertain.  The same fix has been present in Planner for quite a
> while and I haven't heard any complaints about it.

I haven't tested planner for ages: I'll try it soon and see if I can
break it :)

>                                                     Additionally, I
> tried evaluating (featurep 'overlay) before evaluating
> (require 'emms-playlist-mode)
> and afterward.  The results were nil and t, respectively.

That might be because you hadn't byte-compiled emms-playlist-mode.el (or
at least not with the XEmacs byte-compiler). `eval-when-compile' has
somewhat strange semantics: the body is executed when the byte-compiler
processes the form *or* when the form is read by the interpreter, but
not when an .elc is loaded at runtime. (This is easily verifiable with
a one-line testcase. Try executing (eval-when-compile (message "foo")),
then byte-compiling it and loading the resulting .elc, and watch the
` *Message-Log*' buffer.)

I'd say you really do want `eval-and-compile' here, but since you're
only doing a `require' which has those semantics anyway, this reduces to
a plain `require'.

The only situtation in which I can envisage you wanting to put a
`require' in an `eval-when-compile' is when the file required contains
only macros, and that's a dangerous thing to depend upon.

> This is in XEmacs 21.4 (patch 20).  Does your version of XEmacs do the
> same?

No: I get nil both before and after byte-compilation in XEmacs 21.5.28
and 21.4.20 both. Are you sure you didn't typo somewhere?
(Byte-compiling in the same XEmacs session will have the effect you see,
of course, because the byte-compiler will have required 'overlay during
the byte-compilation phase.)

(See the definition of `eval-when-compile' in bytecomp-runtime.el, and
the corresponding definition in `byte-compile-initial-macro-environment'
in bytecomp.el.)

reply via email to

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